aboutsummaryrefslogtreecommitdiffstats
path: root/sources
diff options
context:
space:
mode:
authorCristián Maureira-Fredes <Cristian.Maureira-Fredes@qt.io>2021-09-02 13:44:17 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-11-26 15:03:09 +0000
commitb5663f5d1258eaa29421e8f35311e2352825b238 (patch)
tree374bb82d44e47548b03c18669defb6c0eb7ebaf9 /sources
parentef68b737067258221eb2de6b857112da7a994cca (diff)
Move from distutils to setuptools
This is motivated by the deprecation of distutils, and removal in future versions https://github.com/pypa/packaging-problems/issues/127 Change-Id: I16448b69f98df6dc1d9a904b69eb69ed5f1093f5 Reviewed-by: Christian Tismer <tismer@stackless.com> (cherry picked from commit 95a5bb9dd3b5d3fa86f2ed0868e2b821256a6028) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'sources')
-rw-r--r--sources/pyside6/cmake/PySideSetup.cmake16
-rw-r--r--sources/shiboken6/cmake/ShibokenHelpers.cmake14
-rw-r--r--sources/shiboken6/tests/samplebinding/numpy_test.py2
3 files changed, 26 insertions, 6 deletions
diff --git a/sources/pyside6/cmake/PySideSetup.cmake b/sources/pyside6/cmake/PySideSetup.cmake
index b46d09b57..d4840a4d8 100644
--- a/sources/pyside6/cmake/PySideSetup.cmake
+++ b/sources/pyside6/cmake/PySideSetup.cmake
@@ -195,9 +195,19 @@ endif()
if(NOT PYTHON_SITE_PACKAGES)
execute_process(
COMMAND ${SHIBOKEN_PYTHON_INTERPRETER} -c "if True:
- from distutils import sysconfig
- from os import sep
- print(sysconfig.get_python_lib(1, 0, prefix='${CMAKE_INSTALL_PREFIX}').replace(sep, '/'))
+ import sysconfig
+ from os.path import sep
+
+ # /home/qt/dev/env/lib/python3.9/site-packages
+ lib_path = sysconfig.get_path('purelib')
+
+ # /home/qt/dev/env
+ data_path = sysconfig.get_path('data')
+
+ # /lib/python3.9/site-packages
+ rel_path = lib_path.replace(data_path, '')
+
+ print(f'${CMAKE_INSTALL_PREFIX}{rel_path}'.replace(sep, '/'))
"
OUTPUT_VARIABLE PYTHON_SITE_PACKAGES
OUTPUT_STRIP_TRAILING_WHITESPACE)
diff --git a/sources/shiboken6/cmake/ShibokenHelpers.cmake b/sources/shiboken6/cmake/ShibokenHelpers.cmake
index c17401ccc..87a676219 100644
--- a/sources/shiboken6/cmake/ShibokenHelpers.cmake
+++ b/sources/shiboken6/cmake/ShibokenHelpers.cmake
@@ -78,9 +78,19 @@ endmacro()
macro(set_python_site_packages)
execute_process(
COMMAND ${PYTHON_EXECUTABLE} -c "if True:
- from distutils import sysconfig
+ import sysconfig
from os.path import sep
- print(sysconfig.get_python_lib(1, 0, prefix='${CMAKE_INSTALL_PREFIX}').replace(sep, '/'))
+
+ # /home/qt/dev/env/lib/python3.9/site-packages
+ lib_path = sysconfig.get_path('purelib')
+
+ # /home/qt/dev/env
+ data_path = sysconfig.get_path('data')
+
+ # /lib/python3.9/site-packages
+ rel_path = lib_path.replace(data_path, '')
+
+ print(f'${CMAKE_INSTALL_PREFIX}{rel_path}'.replace(sep, '/'))
"
OUTPUT_VARIABLE PYTHON_SITE_PACKAGES
OUTPUT_STRIP_TRAILING_WHITESPACE)
diff --git a/sources/shiboken6/tests/samplebinding/numpy_test.py b/sources/shiboken6/tests/samplebinding/numpy_test.py
index 61f8c7103..be13fdfda 100644
--- a/sources/shiboken6/tests/samplebinding/numpy_test.py
+++ b/sources/shiboken6/tests/samplebinding/numpy_test.py
@@ -29,7 +29,7 @@
import sys
try:
- from distutils import sysconfig
+ import sysconfig
if bool(sysconfig.get_config_var('Py_DEBUG')):
sys.exit(0)
import numpy