From aa6e2962360ecff5066dacab99e9b81fb910a69f Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Thu, 25 Oct 2018 03:47:59 +0000 Subject: [PATCH] python: eliminate DeprecationWarning: SO -> EXT_SUFFIX - https://python.readthedocs.io/en/stable/whatsnew/3.4.html - The `sysconfig` key `SO` is deprecated, it has been replaced by `EXT_SUFFIX` --- modules/python/common.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/python/common.cmake b/modules/python/common.cmake index cbb79b8..4300abe 100644 --- a/modules/python/common.cmake +++ b/modules/python/common.cmake @@ -43,7 +43,11 @@ ocv_target_link_libraries(${the_module} LINK_PRIVATE ${deps}) if(DEFINED ${PYTHON}_CVPY_SUFFIX) set(CVPY_SUFFIX "${${PYTHON}_CVPY_SUFFIX}") else() - execute_process(COMMAND ${${PYTHON}_EXECUTABLE} -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('SO'))" + set(__python_ext_suffix_var "EXT_SUFFIX") + 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}'))" RESULT_VARIABLE PYTHON_CVPY_PROCESS OUTPUT_VARIABLE CVPY_SUFFIX OUTPUT_STRIP_TRAILING_WHITESPACE) -- 2.7.4