summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/sysconfig.py
diff options
context:
space:
mode:
authorNed Deily <nad@acm.org>2012-07-16 04:30:03 (GMT)
committerNed Deily <nad@acm.org>2012-07-16 04:30:03 (GMT)
commit274717757d1de602e7ec00b82601254a92e5bf33 (patch)
tree5dc98442a42e83d1d3b28f2bae15ea57c30cd1f6 /Lib/distutils/sysconfig.py
parent950b76ab1a28e1492595415eed574f8d0b1a2f01 (diff)
downloadcpython-274717757d1de602e7ec00b82601254a92e5bf33.zip
cpython-274717757d1de602e7ec00b82601254a92e5bf33.tar.gz
cpython-274717757d1de602e7ec00b82601254a92e5bf33.tar.bz2
Issue #13590: Improve support for OS X Xcode 4:
- fix test_distutils and test_sysconfig test failures by aligning sysconfig and distutils.sysconfig tailoring of configure variables (as in 2.7)
Diffstat (limited to 'Lib/distutils/sysconfig.py')
-rw-r--r--Lib/distutils/sysconfig.py29
1 files changed, 26 insertions, 3 deletions
diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
index dac3035..f6e5d99 100644
--- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py
@@ -624,7 +624,7 @@ def get_config_vars(*args):
# are in CFLAGS or LDFLAGS and remove them if they are.
# This is needed when building extensions on a 10.3 system
# using a universal build of python.
- for key in ('LDFLAGS', 'BASECFLAGS',
+ for key in ('LDFLAGS', 'BASECFLAGS', 'LDSHARED',
# a number of derived variables. These need to be
# patched up as well.
'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
@@ -669,16 +669,39 @@ def get_config_vars(*args):
# that OS release.
if 'ARCHFLAGS' in os.environ:
arch = os.environ['ARCHFLAGS']
- for key in ('LDFLAGS', 'BASECFLAGS',
+ for key in ('LDFLAGS', 'BASECFLAGS', 'LDSHARED',
# a number of derived variables. These need to be
# patched up as well.
- 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED', 'LDSHARED'):
+ 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
flags = _config_vars[key]
flags = re.sub('-arch\s+\w+\s', ' ', flags)
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', 'LDSHARED',
+ # 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: