]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
Python: Remove usage of the deprecated distutils module 516/head
authorMiro Hrončok <miro@hroncok.cz>
Mon, 19 Dec 2022 22:07:57 +0000 (23:07 +0100)
committerMiro Hrončok <miro@hroncok.cz>
Mon, 19 Dec 2022 22:07:57 +0000 (23:07 +0100)
Python 3.12+ no longer has distutils.

See https://peps.python.org/pep-0632/

bindings/python/CMakeLists.txt
bindings/python3/CMakeLists.txt
package/libsolv.spec.in

index 64ef528775a97441f2c11b612868527205f7f0cb..186be4195c439d40aeb7fb7e47377d9a7227a46f 100644 (file)
@@ -13,7 +13,7 @@ ELSE()
 ENDIF()
 FIND_PACKAGE (PythonInterp ${python_version} REQUIRED)
 
-EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "from sys import stdout; from distutils import sysconfig; stdout.write(sysconfig.get_python_lib(True))" OUTPUT_VARIABLE PYTHON_INSTALL_DIR)
+EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "from sys import stdout; import sysconfig; stdout.write(sysconfig.get_path('platlib'))" OUTPUT_VARIABLE PYTHON_INSTALL_DIR)
 
 IF (NOT DEFINED PYTHON_VERSION_MAJOR)
     SET (PYTHON_VERSION_MAJOR 2)
index 28e8e00dab5561bc603b1d9c571f949660e9f6c2..021a47f7ba268c03f4200b64e7242f0a942de649 100644 (file)
@@ -10,8 +10,8 @@ IF (NOT DEFINED PYTHON3_EXECUTABLE)
 SET (PYTHON3_EXECUTABLE "/usr/bin/python3")
 ENDIF (NOT DEFINED PYTHON3_EXECUTABLE)
 
-EXECUTE_PROCESS(COMMAND ${PYTHON3_EXECUTABLE} -c "from sys import stdout; from distutils import sysconfig; stdout.write(sysconfig.get_python_lib(True))" OUTPUT_VARIABLE PYTHON3_INSTALL_DIR)
-EXECUTE_PROCESS(COMMAND ${PYTHON3_EXECUTABLE} -c "from sys import stdout; from distutils import sysconfig; stdout.write(sysconfig.get_python_inc())" OUTPUT_VARIABLE PYTHON3_INCLUDE_DIR)
+EXECUTE_PROCESS(COMMAND ${PYTHON3_EXECUTABLE} -c "from sys import stdout; import sysconfig; stdout.write(sysconfig.get_path('platlib'))" OUTPUT_VARIABLE PYTHON3_INSTALL_DIR)
+EXECUTE_PROCESS(COMMAND ${PYTHON3_EXECUTABLE} -c "from sys import stdout; import sysconfig; stdout.write(sysconfig.get_path('include'))" OUTPUT_VARIABLE PYTHON3_INCLUDE_DIR)
 
 SET (SWIG_PY3_FLAGS -DPYTHON3=1)
 SET (SWIG_PY3_FLAGS ${SWIG_PY3_FLAGS} -DSWIG_PYTHON_LEGACY_BOOL=1)
index 5e4e30d2d5df2abd5115bfe76c30b653a7ed6f2e..af867535568cdf22593bbbc47cf12bb34b0e75ee 100644 (file)
@@ -90,13 +90,13 @@ BuildRequires:  swig
 %endif
 
 %if %{with python}
-%global python_sitearch %(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(True))")
+%global python_sitearch %(python -c "from sysconfig import get_path; print(get_path('platlib'))")
 BuildRequires:  python-devel
 BuildRequires:  swig
 %endif
 
 %if %{with python3}
-%global python3_sitearch %(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(True))")
+%global python3_sitearch %(python3 -c "from sysconfig import get_path; print(get_path('platlib'))")
 BuildRequires:  python3-devel
 BuildRequires:  swig
 %endif