summaryrefslogtreecommitdiff
path: root/Lib/distutils/sysconfig.py
diff options
context:
space:
mode:
authorRonald Oussoren <ronaldoussoren@mac.com>2010-07-23 09:43:17 +0000
committerRonald Oussoren <ronaldoussoren@mac.com>2010-07-23 09:43:17 +0000
commitab27866bfc8c136e0a4093294340d02eac3db653 (patch)
tree9d743f6c72dbd8dd972e4dbdb82cc215efb494a2 /Lib/distutils/sysconfig.py
parent8e5e0ff59f49e82790d3cee0cac3ab98d9424764 (diff)
downloadcpython-ab27866bfc8c136e0a4093294340d02eac3db653.tar.gz
Ensure that the Makefile variable expansion
in distutils.sysconfig matches that in the toplevel sysconfig module. Without this patch universal builds on OSX are broken. Als add a test that checks that the two version of get_config_vars agree on important values.
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 0fbd5412bc..48f3fe4d59 100644
--- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py
@@ -300,6 +300,12 @@ def parse_makefile(fn, g=None):
else:
done[n] = v
+ # Variables with a 'PY_' prefix in the makefile. These need to
+ # be made available without that prefix through sysconfig.
+ # Special care is needed to ensure that variable expansion works, even
+ # if the expansion uses the name without a prefix.
+ renamed_variables = ('CFLAGS', 'LDFLAGS', 'CPPFLAGS')
+
# do variable interpolation here
while notdone:
for name in list(notdone):
@@ -316,6 +322,16 @@ def parse_makefile(fn, g=None):
elif n in os.environ:
# do it like make: fall back to environment
item = os.environ[n]
+
+ elif n in renamed_variables:
+ if name.startswith('PY_') and name[3:] in renamed_variables:
+ item = ""
+
+ elif 'PY_' + n in notdone:
+ found = False
+
+ else:
+ item = str(done['PY_' + n])
else:
done[n] = item = ""
if found:
@@ -330,6 +346,13 @@ def parse_makefile(fn, g=None):
else:
done[name] = value
del notdone[name]
+
+ if name.startswith('PY_') \
+ and name[3:] in renamed_variables:
+
+ name = name[3:]
+ if name not in done:
+ done[name] = value
else:
# bogus variable reference; just drop it since we can't deal
del notdone[name]