summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/sysconfig.py
diff options
context:
space:
mode:
authorRonald Oussoren <ronaldoussoren@mac.com>2009-09-22 19:31:34 (GMT)
committerRonald Oussoren <ronaldoussoren@mac.com>2009-09-22 19:31:34 (GMT)
commitd787abffc06141076fe408069b8d10da3870a2c0 (patch)
tree9cf596ec872dc6236ea4386e2388f5a8536da6de /Lib/distutils/sysconfig.py
parent5270fce038be8edc2379090b36780191f8a4bcfb (diff)
downloadcpython-d787abffc06141076fe408069b8d10da3870a2c0.zip
cpython-d787abffc06141076fe408069b8d10da3870a2c0.tar.gz
cpython-d787abffc06141076fe408069b8d10da3870a2c0.tar.bz2
Merged revisions 75022 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r75022 | ronald.oussoren | 2009-09-22 21:27:44 +0200 (Tue, 22 Sep 2009) | 8 lines Half of the fix for issue 6957: ensure that distutils ignores the '-isysroot' option on OSX when the corresponding SDK is not installed. This ensures that the user can compile extensions on OSX 10.6 using the Python.org installer and a default installation of Xcode. ........
Diffstat (limited to 'Lib/distutils/sysconfig.py')
-rw-r--r--Lib/distutils/sysconfig.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
index 6f99de2..8306202 100644
--- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py
@@ -566,6 +566,29 @@ def get_config_vars(*args):
flags = flags + ' ' + arch
_config_vars[key] = flags
+ # If we're on OSX 10.5 or later and the user tries to
+ # compiles an extension using an SDK that is not present
+ # on the current machine it is better to not use an SDK
+ # than to fail.
+ #
+ # The major usecase for this is users using a Python.org
+ # binary installer on OSX 10.6: that installer uses
+ # the 10.4u SDK, but that SDK is not installed by default
+ # when you install Xcode.
+ #
+ m = re.search('-isysroot\s+(\S+)', _config_vars['CFLAGS'])
+ if m is not None:
+ sdk = m.group(1)
+ if not os.path.exists(sdk):
+ for key in ('LDFLAGS', 'BASECFLAGS',
+ # a number of derived variables. These need to be
+ # patched up as well.
+ 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
+
+ flags = _config_vars[key]
+ flags = re.sub('-isysroot\s+\S+(\s|$)', ' ', flags)
+ _config_vars[key] = flags
+
if args:
vals = []
for name in args: