diff options
author | Cristián Maureira-Fredes <cristian.maureira-fredes@qt.io> | 2020-01-27 13:08:18 +0100 |
---|---|---|
committer | Cristián Maureira-Fredes <cristian.maureira-fredes@qt.io> | 2020-01-27 15:13:20 +0100 |
commit | bc77dd5e92b8c0f21aad3b95ac1dafd51cd27c01 (patch) | |
tree | a05948b528416657732d8040b21d64cf811ff8b7 | |
parent | ca5496ab7360a257e81dbc9d8bac653154af7dd3 (diff) |
Fix machinery and pep425tags CI error
Currently the Shiboken macro only handles AttributeError
but when 'machinery' is not found inside 'importlib'
that case also needs to be handle by the except clause.
Adding ImportError will allow us to get access to the
Python suffixes that we need to build.
Additionally, some old versions of Python (2.7.14) require
an "archive_root" parameter on the 'wheel.pep425tags.get_supported'
function, which is not required in new versions (2.7.16, and 3+).
Change-Id: Icc6e7d1e9384ea01eec9281586f7ca988e3eb649
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r-- | build_scripts/wheel_override.py | 13 | ||||
-rw-r--r-- | sources/shiboken2/data/shiboken_helpers.cmake | 2 |
2 files changed, 12 insertions, 3 deletions
diff --git a/build_scripts/wheel_override.py b/build_scripts/wheel_override.py index 62a6bbe86..03c9c92ab 100644 --- a/build_scripts/wheel_override.py +++ b/build_scripts/wheel_override.py @@ -160,8 +160,17 @@ class PysideBuildWheel(_bdist_wheel): else: abi_tag = str(get_abi_tag()).lower() tag = (impl, abi_tag, plat_name) - supported_tags = pep425tags.get_supported( - supplied_platform=plat_name if self.plat_name_supplied else None) + try: + supported_tags = pep425tags.get_supported( + supplied_platform=plat_name if self.plat_name_supplied else None) + except TypeError: + # This was breaking the CI, specifically the: + # OpenSUSE 15 x86_64 using ICC + # Some versions of Python 2.7 require an argument called + # 'archive_root' which doesn't exist on 3, so we set it to + # 'None' for those version (e.g.: Python 2.7.14) + supported_tags = pep425tags.get_supported(None, + supplied_platform=plat_name if self.plat_name_supplied else None) # XXX switch to this alternate implementation for non-pure: if (self.py_limited_api) or (plat_name in ('manylinux1_x86_64') and sys.version_info[0] == 2): return tag diff --git a/sources/shiboken2/data/shiboken_helpers.cmake b/sources/shiboken2/data/shiboken_helpers.cmake index 5d7ff56bb..9772ee597 100644 --- a/sources/shiboken2/data/shiboken_helpers.cmake +++ b/sources/shiboken2/data/shiboken_helpers.cmake @@ -232,7 +232,7 @@ macro(get_python_extension_suffix) try: from importlib import machinery first_suffix = machinery.EXTENSION_SUFFIXES[0] - except AttributeError: + except (AttributeError, ImportError): import imp first_suffix = imp.get_suffixes()[0][0] res = re.search(r'^(.+)\\.', first_suffix) |