@@ -10,6 +10,8 @@ |
|
|
10 |
10 |
from os.path import join as pjoin |
11 |
11 |
|
12 |
12 |
import pkg_resources |
|
13 |
+import platform |
|
14 |
+from distutils.sysconfig import get_config_var |
13 |
15 |
import sys |
14 |
16 |
import shutil |
15 |
17 |
from distutils.version import LooseVersion |
@@ -24,6 +26,10 @@ def is_platform_windows(): |
|
|
24 |
26 |
return sys.platform == 'win32' or sys.platform == 'cygwin' |
25 |
27 |
|
26 |
28 |
|
|
29 |
+def is_platform_mac(): |
|
30 |
+return sys.platform == 'darwin' |
|
31 |
+ |
|
32 |
+ |
27 |
33 |
min_numpy_ver = '1.12.0' |
28 |
34 |
setuptools_kwargs = { |
29 |
35 |
'install_requires': [ |
@@ -434,6 +440,19 @@ def get_tag(self): |
|
|
434 |
440 |
extra_compile_args = ['-Wno-unused-function'] |
435 |
441 |
|
436 |
442 |
|
|
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 |
+ |
437 |
456 |
# enable coverage by building cython files by setting the environment variable |
438 |
457 |
# "PANDAS_CYTHON_COVERAGE" (with a Truthy value) or by running build_ext |
439 |
458 |
# with `--with-cython-coverage`enabled |