Skip to content

Commit

Permalink
Revert "Remove python code using distutils. Bump required to 3.22.1"
Browse files Browse the repository at this point in the history
This reverts commit aebfe55.
  • Loading branch information
j-rivero committed Apr 19, 2024
1 parent 83e5e3b commit 1d9e211
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)

#============================================================================
# Initialize the project
Expand Down
13 changes: 12 additions & 1 deletion python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,18 @@ endif()


if(USE_SYSTEM_PATHS_FOR_PYTHON_INSTALLATION)
find_package(Python3 COMPONENTS Interpreter)
if(${CMAKE_VERSION} VERSION_LESS "3.12.0")
execute_process(
COMMAND "${PYTHON_EXECUTABLE}" -c "if True:
from distutils import sysconfig as sc
print(sc.get_python_lib(plat_specific=True))"
OUTPUT_VARIABLE Python3_SITEARCH
OUTPUT_STRIP_TRAILING_WHITESPACE)
else()
# Get install variable from Python3 module
# Python3_SITEARCH is available from 3.12 on, workaround if needed:
find_package(Python3 COMPONENTS Interpreter)
endif()

if(USE_DIST_PACKAGES_FOR_PYTHON)
string(REPLACE "site-packages" "dist-packages" GZ_PYTHON_INSTALL_PATH ${Python3_SITEARCH})
Expand Down

0 comments on commit 1d9e211

Please sign in to comment.