blob: f3f8cf773bf7deed30a459d4ea74e73e4f719970 [file] [log] [blame]
From 9a8e01f8421f92f40b4cbff6cf055538e9a0b0ae Mon Sep 17 00:00:00 2001
From: Evgeny Kolesnikov <ekolesni@redhat.com>
Date: Thu, 25 Jan 2024 21:37:05 +0100
Subject: [PATCH] Replace distutils.sysconfig with sysconfig
Upstream-Status: Backport
[https://github.com/OpenSCAP/openscap/commit/9a8e01f8421f92f40b4cbff6cf055538e9a0b0ae]
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
---
docs/developer/developer.adoc | 2 +-
swig/python3/CMakeLists.txt | 2 +-
utils/CMakeLists.txt | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/docs/developer/developer.adoc b/docs/developer/developer.adoc
index 77c6d5161..e923069cc 100644
--- a/docs/developer/developer.adoc
+++ b/docs/developer/developer.adoc
@@ -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
diff --git a/swig/python3/CMakeLists.txt b/swig/python3/CMakeLists.txt
index 2594cf000..5f301326c 100644
--- a/swig/python3/CMakeLists.txt
+++ b/swig/python3/CMakeLists.txt
@@ -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
)
diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt
index 93ce1f2a9..9347c2976 100644
--- a/utils/CMakeLists.txt
+++ b/utils/CMakeLists.txt
@@ -91,7 +91,7 @@ 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
)
--
2.25.1