Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b87a4a2

Browse files
authoredMay 28, 2024··
Merge pull request #478 from Moraxyc/master
build(cmake): avoid the usage of distutils
2 parents 2223b99 + e72006d commit b87a4a2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed
 

‎cmake/FindPython.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
set(PYTHON_BIN python CACHE STRING "Python executable name")
22

33
execute_process(
4-
COMMAND ${PYTHON_BIN} -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())"
4+
COMMAND ${PYTHON_BIN} -c "from sysconfig import get_paths; print(get_paths()['include'])"
55
OUTPUT_VARIABLE PYTHON_SYS_PATH
66
)
77
string(STRIP ${PYTHON_SYS_PATH} PYTHON_SYS_PATH)
@@ -16,7 +16,7 @@ set(PYTHON_INSTALL_HEADER_PATH ${PYTHON_INCLUDE_PATH}/symengine
1616
CACHE BOOL "Python install headers path")
1717

1818
execute_process(
19-
COMMAND ${PYTHON_BIN} -c "from distutils.sysconfig import get_config_var; print(get_config_var('LIBDIR'))"
19+
COMMAND ${PYTHON_BIN} -c "from sysconfig import get_config_var; print(get_config_var('LIBDIR'))"
2020
OUTPUT_VARIABLE PYTHON_LIB_PATH
2121
)
2222
string(STRIP ${PYTHON_LIB_PATH} PYTHON_LIB_PATH)
@@ -50,7 +50,7 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
5050
endif()
5151

5252
execute_process(
53-
COMMAND ${PYTHON_BIN} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
53+
COMMAND ${PYTHON_BIN} -c "from sysconfig import get_paths; print(get_paths()['purelib'])"
5454
OUTPUT_VARIABLE PYTHON_INSTALL_PATH_tmp
5555
)
5656
string(STRIP ${PYTHON_INSTALL_PATH_tmp} PYTHON_INSTALL_PATH_tmp)

‎cmake/get_suffix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from distutils.sysconfig import get_config_var
1+
from sysconfig import get_config_var
22
extsuffix = get_config_var('EXT_SUFFIX')
33
if extsuffix is None:
44
print("")

0 commit comments

Comments
 (0)
Please sign in to comment.