Skip to content

Commit

Permalink
Replace distutils.sysconfig with sysconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
evgenyz committed Jan 25, 2024
1 parent 51e587a commit 1c3bf05
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/developer/developer.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ On Ubuntu 18.04 and potentially other distro, the python3 dist-packages path is
If the following command:

----
$ python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
$ python3 -c "import sysconfig; print(sysconfig.get_path('platlib'))"
----

returns "/usr/local/lib/python3/dist-packages" instead of a path like
Expand Down
2 changes: 1 addition & 1 deletion swig/python3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ add_custom_target(python3_compile ALL DEPENDS ${PYTHON_COMPILED_FILES})

if(NOT PYTHON_SITE_PACKAGES_INSTALL_DIR)
execute_process(COMMAND
${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(True, prefix='${CMAKE_INSTALL_PREFIX}'))"
${PYTHON_EXECUTABLE} -c "import sysconfig; print(sysconfig.get_path('platlib'))"
OUTPUT_VARIABLE PYTHON_SITE_PACKAGES_INSTALL_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
Expand Down
3 changes: 2 additions & 1 deletion utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,11 @@ if(ENABLE_OSCAP_UTIL_DOCKER)

if(NOT PYTHON_SITE_PACKAGES_INSTALL_DIR)
execute_process(COMMAND
${OSCAP_DOCKER_PYTHON} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(False, False, prefix='${CMAKE_INSTALL_PREFIX}'))"
${OSCAP_DOCKER_PYTHON} -c "import sysconfig; print(sysconfig.get_path('purelib'))"
OUTPUT_VARIABLE PYTHON_SITE_PACKAGES_INSTALL_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message("PYTHON_SITE_PACKAGES_INSTALL_DIR: ${PYTHON_SITE_PACKAGES_INSTALL_DIR}")
endif()

install(DIRECTORY oscap_docker_python
Expand Down

0 comments on commit 1c3bf05

Please sign in to comment.