mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-28 07:48:37 -04:00
CMake: Switch use of distutils.sysconfig to sysconfig in Python 3.12
Part of #1395
This commit is contained in:
parent
c48fcba3d8
commit
39e4e4167c
@ -257,6 +257,10 @@ if(HAVE_PYTHON)
|
|||||||
set(_ARCH_DIR ".")
|
set(_ARCH_DIR ".")
|
||||||
|
|
||||||
elseif(PYTHON_EXECUTABLE)
|
elseif(PYTHON_EXECUTABLE)
|
||||||
|
# Python 3.12 drops the distutils module, so we have to use the newer
|
||||||
|
# sysconfig module instead. Earlier versions of Python had the newer
|
||||||
|
# module too, but it was broken in Debian/Ubuntu, see #1230
|
||||||
|
if(PYTHON_VERSION_STRING VERSION_LESS "3.12")
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${PYTHON_EXECUTABLE}
|
COMMAND ${PYTHON_EXECUTABLE}
|
||||||
-c "from distutils.sysconfig import get_python_lib; print(get_python_lib(False))"
|
-c "from distutils.sysconfig import get_python_lib; print(get_python_lib(False))"
|
||||||
@ -267,6 +271,18 @@ if(HAVE_PYTHON)
|
|||||||
-c "from distutils.sysconfig import get_python_lib; print(get_python_lib(True))"
|
-c "from distutils.sysconfig import get_python_lib; print(get_python_lib(True))"
|
||||||
OUTPUT_VARIABLE _ARCH_DIR
|
OUTPUT_VARIABLE _ARCH_DIR
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
else()
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${PYTHON_EXECUTABLE}
|
||||||
|
-c "import sysconfig; print(sysconfig.get_path('purelib'))"
|
||||||
|
OUTPUT_VARIABLE _LIB_DIR
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${PYTHON_EXECUTABLE}
|
||||||
|
-c "import sysconfig; print(sysconfig.get_path('platlib'))"
|
||||||
|
OUTPUT_VARIABLE _ARCH_DIR
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
endif()
|
||||||
|
|
||||||
else()
|
else()
|
||||||
set(_LIB_DIR "")
|
set(_LIB_DIR "")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user