From 99f9941067c3b3db2f6c94a0659030259ffeecf9 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Sat, 24 Feb 2024 10:38:55 -0500 Subject: [PATCH] Use deb_system Python sysconfig scheme on Debian --- CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 37885ad053..7265a4f4fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -877,7 +877,14 @@ check_find_package_result( PYTHONINTERP_FOUND "Python Interpreter" ) # Get the correct Python site package install path from the Python interpreter found by # FindPythonInterp unless the user specifically defined a custom path. if( NOT PYTHON_SITE_PACKAGE_PATH ) - execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "import sysconfig;print(\"%s\"%sysconfig.get_path('platlib', vars={'platbase': '.'}))" + execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "import sys, sysconfig +if 'deb_system' in sysconfig.get_scheme_names(): + scheme = 'deb_system' +elif sys.version_info > (3, 10): + scheme = sysconfig.get_default_scheme() +else: + scheme = sysconfig._get_default_scheme() +print(\"%s\"%sysconfig.get_path('platlib', vars={'platbase': '.'}, scheme=scheme))" OUTPUT_VARIABLE PYTHON_SITE_PACKAGE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE )