summarylogtreecommitdiffstats
path: root/af88dbc6ecf8e6a0f6c50b50b1c7a8df2256cdf2.patch
blob: 38e2c8c8406d2e787bc7f5f72eac6ad90b660288 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
diff --git a/colcon_python_setup_py/package_identification/python_setup_py.py b/colcon_python_setup_py/package_identification/python_setup_py.py
index 9037e84..7a513a0 100644
--- a/colcon_python_setup_py/package_identification/python_setup_py.py
+++ b/colcon_python_setup_py/package_identification/python_setup_py.py
@@ -248,7 +248,14 @@ def _get_setup_information(setup_py, *, env=None):
         'import sys',
         # setuptools needs to be imported before distutils
         # to avoid warning introduced in setuptools 49.2.0
-        'from setuptools.extern.packaging.specifiers import SpecifierSet',
+        'from contextlib import suppress',
+        'exec("with suppress(ImportError):'
+        '    from setuptools.extern.packaging.specifiers'
+        '    import SpecifierSet")',
+        # newer versions expose 'packaging' directly
+        # on Arch 'extern' isn't part of the package
+        'exec("with suppress(ImportError):'
+        '    from packaging.specifiers import SpecifierSet")',
         'from distutils.core import run_setup',
 
         'dist = run_setup(