aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/data/shiboken_helpers.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken2/data/shiboken_helpers.cmake')
-rw-r--r--sources/shiboken2/data/shiboken_helpers.cmake28
1 files changed, 17 insertions, 11 deletions
diff --git a/sources/shiboken2/data/shiboken_helpers.cmake b/sources/shiboken2/data/shiboken_helpers.cmake
index 8111fa61f..5e0c6ea72 100644
--- a/sources/shiboken2/data/shiboken_helpers.cmake
+++ b/sources/shiboken2/data/shiboken_helpers.cmake
@@ -206,7 +206,7 @@ endmacro()
macro(set_quiet_build)
# Don't display "up-to-date / install" messages when installing, to reduce visual clutter.
- set(CMAKE_INSTALL_MESSAGE NEVER PARENT_SCOPE)
+ set(CMAKE_INSTALL_MESSAGE NEVER)
# Override message not to display info messages when doing a quiet build.
function(message)
list(GET ARGV 0 MessageType)
@@ -221,15 +221,20 @@ macro(set_quiet_build)
endmacro()
macro(get_python_extension_suffix)
- # Result of imp.get_suffixes() depends on the platform, but generally looks something like:
- # [('.cpython-34m-x86_64-linux-gnu.so', 'rb', 3), ('.cpython-34m.so', 'rb', 3),
- # ('.abi3.so', 'rb', 3), ('.so', 'rb', 3), ('.py', 'r', 1), ('.pyc', 'rb', 2)]
- # We pick the first most detailed one, strip of the file extension part.
+ # Result of importlib.machinery.EXTENSION_SUFFIXES depends on the platform,
+ # but generally looks something like:
+ # ['.cpython-38-x86_64-linux-gnu.so', '.abi3.so', '.so']
+ # We pick the first most detailed one.
execute_process(
COMMAND ${PYTHON_EXECUTABLE} -c "if True:
- import imp, re
- first_suffix = imp.get_suffixes()[0][0]
+ import re
+ try:
+ from importlib import machinery
+ first_suffix = machinery.EXTENSION_SUFFIXES[0]
+ except (AttributeError, ImportError):
+ import imp
+ first_suffix = imp.get_suffixes()[0][0]
res = re.search(r'^(.+)\\.', first_suffix)
if res:
first_suffix = res.group(1)
@@ -239,7 +244,7 @@ macro(get_python_extension_suffix)
"
OUTPUT_VARIABLE PYTHON_EXTENSION_SUFFIX
OUTPUT_STRIP_TRAILING_WHITESPACE)
- message("PYTHON_EXTENSION_SUFFIX: " ${PYTHON_EXTENSION_SUFFIX})
+ message(STATUS "PYTHON_EXTENSION_SUFFIX: " ${PYTHON_EXTENSION_SUFFIX})
endmacro()
macro(get_llvm_config)
@@ -255,7 +260,7 @@ macro(get_llvm_config)
"
OUTPUT_VARIABLE LLVM_CONFIG
OUTPUT_STRIP_TRAILING_WHITESPACE)
- message("LLVM_CONFIG: " ${LLVM_CONFIG})
+ message(STATUS "LLVM_CONFIG: " ${LLVM_CONFIG})
endmacro()
macro(get_python_arch)
@@ -266,7 +271,7 @@ macro(get_python_arch)
"
OUTPUT_VARIABLE PYTHON_ARCH
OUTPUT_STRIP_TRAILING_WHITESPACE)
- message("PYTHON_ARCH: " ${PYTHON_ARCH})
+ message(STATUS "PYTHON_ARCH: " ${PYTHON_ARCH})
endmacro()
macro(shiboken_parse_all_arguments prefix type flags options multiopts)
@@ -282,8 +287,9 @@ macro(shiboken_check_if_limited_api)
# On other platforms, this result is not used at all.
execute_process(
COMMAND ${PYTHON_EXECUTABLE} -c "if True:
+ import os
for lib in '${PYTHON_LIBRARIES}'.split(';'):
- if '/' in lib:
+ if '/' in lib and os.path.isfile(lib):
prefix, py = lib.rsplit('/', 1)
if py.startswith('python3'):
print(prefix + '/python3.lib')