diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-07-15 17:42:51 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-07-28 00:40:41 +0200 |
| commit | 01ea79fbb6a57f22a587d34252f0a256abfdf01f (patch) | |
| tree | 82f9e6a6efb8c0a2a2e9c7264312efc9b64a61b8 | |
| parent | 5929e397bbe41c45ba416ce87dfa5b431ea224c9 (diff) | |
Use sysconfig in cmake
Change-Id: I513a6e146b7892fc9c0f9e44e92c2c2000f011e5
Reviewed-by: Christian Tismer <tismer@stackless.com>
| -rw-r--r-- | sources/shiboken6/CMakeLists.txt | 20 | ||||
| -rw-r--r-- | sources/shiboken6/data/shiboken_helpers.cmake | 21 |
2 files changed, 9 insertions, 32 deletions
diff --git a/sources/shiboken6/CMakeLists.txt b/sources/shiboken6/CMakeLists.txt index 07eabd635..6dbdac750 100644 --- a/sources/shiboken6/CMakeLists.txt +++ b/sources/shiboken6/CMakeLists.txt @@ -140,24 +140,10 @@ endif() # On Linux distros there is no standard way to check that. execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "if True: - is_py_debug = False import sys - try: - sys_py_debug = sys.pydebug - if sys_py_debug: - is_py_debug = True - except: - pass - - try: - from distutils import sysconfig - config_py_debug = sysconfig.get_config_var('Py_DEBUG') - if config_py_debug: - is_py_debug = True - except: - pass - - print(bool(is_py_debug)) + import sysconfig + config_py_debug = sysconfig.get_config_var('Py_DEBUG') + print(bool(config_py_debug)) " OUTPUT_VARIABLE PYTHON_WITH_DEBUG OUTPUT_STRIP_TRAILING_WHITESPACE) diff --git a/sources/shiboken6/data/shiboken_helpers.cmake b/sources/shiboken6/data/shiboken_helpers.cmake index 7b81abb65..7e772c7fd 100644 --- a/sources/shiboken6/data/shiboken_helpers.cmake +++ b/sources/shiboken6/data/shiboken_helpers.cmake @@ -142,26 +142,17 @@ macro(set_quiet_build) endmacro() macro(get_python_extension_suffix) - # 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 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) + import sysconfig + suffix = sysconfig.get_config_var('EXT_SUFFIX') + res = re.search(r'^(.+)\\.', suffix) if res: - first_suffix = res.group(1) + suffix = res.group(1) else: - first_suffix = '' - print(first_suffix) + suffix = '' + print(suffix) " OUTPUT_VARIABLE PYTHON_EXTENSION_SUFFIX OUTPUT_STRIP_TRAILING_WHITESPACE) |
