Skip to content

Commit 459ebb2

Browse files
robbuckleyjreback
authored andcommitted
BLD: for C extension builds on mac, target macOS 10.9 where possible (#24274)
1 parent 24a50fc commit 459ebb2

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

doc/source/whatsnew/v0.24.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -1630,6 +1630,7 @@ Build Changes
16301630

16311631
- Building pandas for development now requires ``cython >= 0.28.2`` (:issue:`21688`)
16321632
- Testing pandas now requires ``hypothesis>=3.58``. You can find `the Hypothesis docs here <https://hypothesis.readthedocs.io/en/latest/index.html>`_, and a pandas-specific introduction :ref:`in the contributing guide <using-hypothesis>`. (:issue:`22280`)
1633+
- Building pandas on macOS now targets minimum macOS 10.9 if run on macOS 10.9 or above (:issue:`23424`)
16331634

16341635
Other
16351636
^^^^^

setup.py

+19
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
from os.path import join as pjoin
1111

1212
import pkg_resources
13+
import platform
14+
from distutils.sysconfig import get_config_var
1315
import sys
1416
import shutil
1517
from distutils.version import LooseVersion
@@ -24,6 +26,10 @@ def is_platform_windows():
2426
return sys.platform == 'win32' or sys.platform == 'cygwin'
2527

2628

29+
def is_platform_mac():
30+
return sys.platform == 'darwin'
31+
32+
2733
min_numpy_ver = '1.12.0'
2834
setuptools_kwargs = {
2935
'install_requires': [
@@ -434,6 +440,19 @@ def get_tag(self):
434440
extra_compile_args = ['-Wno-unused-function']
435441

436442

443+
# For mac, ensure extensions are built for macos 10.9 when compiling on a
444+
# 10.9 system or above, overriding distuitls behaviour which is to target
445+
# the version that python was built for. This may be overridden by setting
446+
# MACOSX_DEPLOYMENT_TARGET before calling setup.py
447+
if is_platform_mac():
448+
if 'MACOSX_DEPLOYMENT_TARGET' not in os.environ:
449+
current_system = LooseVersion(platform.mac_ver()[0])
450+
python_target = LooseVersion(
451+
get_config_var('MACOSX_DEPLOYMENT_TARGET'))
452+
if python_target < '10.9' and current_system >= '10.9':
453+
os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.9'
454+
455+
437456
# enable coverage by building cython files by setting the environment variable
438457
# "PANDAS_CYTHON_COVERAGE" (with a Truthy value) or by running build_ext
439458
# with `--with-cython-coverage`enabled

0 commit comments

Comments
 (0)