From d6891c705e269465222049510ef0920a47507ca9 Mon Sep 17 00:00:00 2001 From: Andrey Senyaev <76472231+asenyaev@users.noreply.github.com> Date: Wed, 8 Dec 2021 21:51:34 +0300 Subject: [PATCH] Merge pull request #21219 from asenyaev:asen/remove_distutils * Replaced distutils module to sysconfig * Fixed getting a path to python lib --- cmake/OpenCVDetectPython.cmake | 2 +- modules/python/common.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/OpenCVDetectPython.cmake b/cmake/OpenCVDetectPython.cmake index 4ff02a77d3..6e7bb18c1b 100644 --- a/cmake/OpenCVDetectPython.cmake +++ b/cmake/OpenCVDetectPython.cmake @@ -177,7 +177,7 @@ if(NOT ${found}) if(NOT ANDROID AND NOT IOS) if(CMAKE_HOST_UNIX) - execute_process(COMMAND ${_executable} -c "from distutils.sysconfig import *; print(get_python_lib())" + execute_process(COMMAND ${_executable} -c "from sysconfig import *; print(get_path('purelib'))" RESULT_VARIABLE _cvpy_process OUTPUT_VARIABLE _std_packages_path OUTPUT_STRIP_TRAILING_WHITESPACE) diff --git a/modules/python/common.cmake b/modules/python/common.cmake index ebbb2e2f65..301cda20b9 100644 --- a/modules/python/common.cmake +++ b/modules/python/common.cmake @@ -63,7 +63,7 @@ else() if("${${PYTHON}_VERSION_MAJOR}" STREQUAL "2") set(__python_ext_suffix_var "SO") endif() - execute_process(COMMAND ${${PYTHON}_EXECUTABLE} -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('${__python_ext_suffix_var}'))" + execute_process(COMMAND ${${PYTHON}_EXECUTABLE} -c "import sysconfig; print(sysconfig.get_config_var('${__python_ext_suffix_var}'))" RESULT_VARIABLE PYTHON_CVPY_PROCESS OUTPUT_VARIABLE CVPY_SUFFIX OUTPUT_STRIP_TRAILING_WHITESPACE)