summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2023-07-30 14:54:47 (GMT)
committerBrad King <brad.king@kitware.com>2023-07-31 19:00:44 (GMT)
commitb02f3872d058bbb70b431c259bd589ef5e35516c (patch)
tree18c12bf20352c830c9be0fada2ed0ce6062cb9e0
parent094b98a3746ca3a352d5bf6a74dd6fc8c3d72364 (diff)
downloadCMake-b02f3872d058bbb70b431c259bd589ef5e35516c.zip
CMake-b02f3872d058bbb70b431c259bd589ef5e35516c.tar.gz
CMake-b02f3872d058bbb70b431c259bd589ef5e35516c.tar.bz2
FindPython: Restore Python_SITE* values for versions below 3.10
Debian based distributions have a buggy sysconfig package. So, rely on distutils.sysconfig if python version is less than 3.10. Fixes: #25135
-rw-r--r--Modules/FindPython/Support.cmake2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake
index 76d4a9b..f78433d 100644
--- a/Modules/FindPython/Support.cmake
+++ b/Modules/FindPython/Support.cmake
@@ -2197,7 +2197,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
# retrieve various package installation directories
execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c
- "import sys\ntry:\n import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_path('stdlib'),sysconfig.get_path('platstdlib'),sysconfig.get_path('purelib'),sysconfig.get_path('platlib')]))\nexcept Exception:\n from distutils import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_python_lib(plat_specific=False,standard_lib=True),sysconfig.get_python_lib(plat_specific=True,standard_lib=True),sysconfig.get_python_lib(plat_specific=False,standard_lib=False),sysconfig.get_python_lib(plat_specific=True,standard_lib=False)]))"
+ "import sys\nif sys.version_info >= (3,10):\n import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_path('stdlib'),sysconfig.get_path('platstdlib'),sysconfig.get_path('purelib'),sysconfig.get_path('platlib')]))\nelse:\n from distutils import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_python_lib(plat_specific=False,standard_lib=True),sysconfig.get_python_lib(plat_specific=True,standard_lib=True),sysconfig.get_python_lib(plat_specific=False,standard_lib=False),sysconfig.get_python_lib(plat_specific=True,standard_lib=False)]))"
RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
OUTPUT_VARIABLE _${_PYTHON_PREFIX}_LIBPATHS
ERROR_QUIET)