|
4 | 4 | from setuptools import setup, find_packages |
5 | 5 | from typing import Optional, Tuple |
6 | 6 |
|
| 7 | + |
| 8 | +PYTHON_REQUIRES = ">=3.7" |
| 9 | +if sys.platform == "darwin": |
| 10 | + import platform |
| 11 | + try: |
| 12 | + macos_major_version = int(platform.release().split(".")[0]) |
| 13 | + if macos_major_version >= 20: |
| 14 | + # We are running macOS Big Sur or later. |
| 15 | + # The new shared cache on Big Sur breaks `ctypes.util.find_library`, |
| 16 | + # which is used by the `cxxfilt` dependency. |
| 17 | + # https://stackoverflow.com/questions/62587131/macos-big-sur-python-ctypes-find-library-does-not-find-libraries-ssl-corefou/63609524#63609524 |
| 18 | + # https://github.com/python/cpython/pull/22855 |
| 19 | + # This wasn't patched in CPython until version 3.9.1, so require that: |
| 20 | + PYTHON_REQUIRES = ">=3.9.1" |
| 21 | + except ValueError: |
| 22 | + pass |
| 23 | + |
7 | 24 | SETUP_DIR = os.path.dirname(os.path.realpath(__file__)) |
8 | 25 | POLYTRACKER_HEADER = os.path.join(SETUP_DIR, 'polytracker', 'include', 'polytracker', 'polytracker.h') |
9 | 26 |
|
@@ -58,7 +75,7 @@ def polytracker_version_string() -> str: |
58 | 75 | author='Trail of Bits', |
59 | 76 | version=polytracker_version_string(), |
60 | 77 | packages=find_packages(), |
61 | | - python_requires='>=3.7', |
| 78 | + python_requires=PYTHON_REQUIRES, |
62 | 79 | install_requires=[ |
63 | 80 | 'cxxfilt==0.2.2', |
64 | 81 | 'docker==4.4.0', |
|
0 commit comments