|
1 | 1 | import os
|
| 2 | +import platform |
2 | 3 | import sys
|
3 | 4 | import subprocess
|
| 5 | +from sysconfig import get_config_vars |
| 6 | + |
| 7 | +from pkg_resources import parse_version |
4 | 8 | from setuptools import setup, find_packages, Extension
|
5 | 9 |
|
| 10 | +# From https://github.com/pandas-dev/pandas/pull/24274: |
| 11 | +# For mac, ensure extensions are built for macos 10.9 when compiling on a |
| 12 | +# 10.9 system or above, overriding distuitls behaviour which is to target |
| 13 | +# the version that python was built for. This may be overridden by setting |
| 14 | +# MACOSX_DEPLOYMENT_TARGET before calling setup.py |
| 15 | +if sys.platform == "darwin": |
| 16 | + if "MACOSX_DEPLOYMENT_TARGET" not in os.environ: |
| 17 | + current_system = platform.mac_ver()[0] |
| 18 | + python_target = get_config_vars().get( |
| 19 | + "MACOSX_DEPLOYMENT_TARGET", current_system |
| 20 | + ) |
| 21 | + target_macos_version = "10.9" |
| 22 | + |
| 23 | + parsed_python_target = parse_version(python_target) |
| 24 | + parsed_current_system = parse_version(current_system) |
| 25 | + parsed_macos_version = parse_version(target_macos_version) |
| 26 | + if parsed_python_target <= parsed_macos_version <= parsed_current_system: |
| 27 | + os.environ["MACOSX_DEPLOYMENT_TARGET"] = target_macos_version |
| 28 | + |
6 | 29 | if sys.version_info[:2] == (3, 6):
|
7 | 30 | clinic_file = "tools/py36_clinic.py"
|
8 | 31 | elif sys.version_info[:2] == (3, 7):
|
|
0 commit comments