Skip to content
Snippets Groups Projects
Commit 5667a08c authored by Omar Valsson's avatar Omar Valsson Committed by Giovanni Bussi
Browse files

Fix for problem with compiling the PYTHON interface in Mac OS 10.14 and higher.

Sets the deployment target to 10.9 when compiling on version 10.9 and above.
The fix is taken from https://github.com/pandas-dev/pandas/pull/24274/files

GB: removed whitespace change and merged. Closes #445

Thanks @valsson
parent 6db6d6ff
No related branches found
No related tags found
No related merge requests found
...@@ -29,6 +29,13 @@ import os ...@@ -29,6 +29,13 @@ import os
import os.path import os.path
import sys import sys
from shutil import copyfile from shutil import copyfile
import platform
from distutils.sysconfig import get_config_var
from distutils.version import LooseVersion
def is_platform_mac():
return sys.platform == 'darwin'
if os.getenv("plumed_macports") is not None: if os.getenv("plumed_macports") is not None:
copyfile("../VERSION","VERSION") copyfile("../VERSION","VERSION")
...@@ -52,6 +59,19 @@ if defaultkernel is not None: ...@@ -52,6 +59,19 @@ if defaultkernel is not None:
extra_compile_args.append("-D__PLUMED_DEFAULT_KERNEL=" + os.path.abspath(defaultkernel)) extra_compile_args.append("-D__PLUMED_DEFAULT_KERNEL=" + os.path.abspath(defaultkernel))
print( "Hardcoded PLUMED_KERNEL " + os.path.abspath(defaultkernel)) print( "Hardcoded PLUMED_KERNEL " + os.path.abspath(defaultkernel))
# Fixes problem with compiling the PYTHON interface in Mac OS 10.14 and higher.
# Sets the deployment target to 10.9 when compiling on version 10.9 and above,
# overriding distutils behaviour to target the Mac OS version python was built for.
# This can be overridden by setting MACOSX_DEPLOYMENT_TARGET before compiling the
# python interface.
# This fix is taken from https://github.com/pandas-dev/pandas/pull/24274/files
if is_platform_mac():
if 'MACOSX_DEPLOYMENT_TARGET' not in os.environ:
current_system = LooseVersion(platform.mac_ver()[0])
python_target = LooseVersion(get_config_var('MACOSX_DEPLOYMENT_TARGET'))
if python_target < '10.9' and current_system >= '10.9':
os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.9'
def readme(): def readme():
with open('README.rst') as f: with open('README.rst') as f:
return f.read() return f.read()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment