diff options
author | Stefan van der Walt <stefan@sun.ac.za> | 2009-02-12 05:44:07 +0000 |
---|---|---|
committer | Stefan van der Walt <stefan@sun.ac.za> | 2009-02-12 05:44:07 +0000 |
commit | cebdbb3cffd595a3529f6480f61798a9f8499b9c (patch) | |
tree | c50b4a45af14a0e969032c685922b76c281349cc /numpy | |
parent | 0672fd89b34b298928ca186af8ebee41d927da8f (diff) | |
download | numpy-cebdbb3cffd595a3529f6480f61798a9f8499b9c.tar.gz |
Trust user's specification of MACOSX_DEPLOYMENT_TARGET [patch by Brian
Granger].
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/distutils/fcompiler/gnu.py | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/numpy/distutils/fcompiler/gnu.py b/numpy/distutils/fcompiler/gnu.py index 800677399..1fb4d3e25 100644 --- a/numpy/distutils/fcompiler/gnu.py +++ b/numpy/distutils/fcompiler/gnu.py @@ -87,21 +87,29 @@ class GnuFCompiler(FCompiler): def get_flags_linker_so(self): opt = self.linker_so[1:] if sys.platform=='darwin': - # MACOSX_DEPLOYMENT_TARGET must be at least 10.3. This is - # a reasonable default value even when building on 10.4 when using - # the official Python distribution and those derived from it (when - # not broken). target = os.environ.get('MACOSX_DEPLOYMENT_TARGET', None) - if target is None or target == '': - target = '10.3' - major, minor = target.split('.') - if int(minor) < 3: - minor = '3' - warnings.warn('Environment variable ' - 'MACOSX_DEPLOYMENT_TARGET reset to %s.%s' % (major, minor)) - os.environ['MACOSX_DEPLOYMENT_TARGET'] = '%s.%s' % (major, - minor) - + # If MACOSX_DEPLOYMENT_TARGET is set, we simply trust the value + # and leave it alone. But, distutils will complain if the + # environment's value is different from the one in the Python + # Makefile used to build Python. We let disutils handle this + # error checking. + if not target: + # If MACOSX_DEPLOYMENT_TARGET is not set in the environment, + # we try to get it first from the Python Makefile and then we + # fall back to setting it to 10.3 to maximize the set of + # versions we can work with. This is a reasonable default + # even when using the official Python dist and those derived + # from it. + import distutils.sysconfig as sc + g = {} + filename = sc.get_makefile_filename() + sc.parse_makefile(filename, g) + target = g.get('MACOSX_DEPLOYMENT_TARGET', '10.3') + os.environ['MACOSX_DEPLOYMENT_TARGET'] = target + if target == '10.3': + s = 'Env. variable MACOSX_DEPLOYMENT_TARGET set to 10.3' + warnings.warn(s) + opt.extend(['-undefined', 'dynamic_lookup', '-bundle']) else: opt.append("-shared") |