summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/sysconfig.py
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2001-01-16 16:33:28 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2001-01-16 16:33:28 (GMT)
commitb11bd03626f2c4bb545bac0ba2150d6e168faccd (patch)
treee5629e97e94f5275ecb77563b02cd4292c5360f5 /Lib/distutils/sysconfig.py
parent9710297e365185e7cdb1a1075a6a1b3d378bd4fc (diff)
downloadcpython-b11bd03626f2c4bb545bac0ba2150d6e168faccd.zip
cpython-b11bd03626f2c4bb545bac0ba2150d6e168faccd.tar.gz
cpython-b11bd03626f2c4bb545bac0ba2150d6e168faccd.tar.bz2
Fix bugs with integer-valued variables when parsing Makefiles. Values
for done[n] can be integers as well as strings, but the code concatenates them with strings (fixed by adding a str()) and calls string.strip() on them (fixed by rearranging the logic) (Presumably this wasn't noticed previously because parse_makefile() was only called on Modules/Makefile, which contains no integer-valued variables.)
Diffstat (limited to 'Lib/distutils/sysconfig.py')
-rw-r--r--Lib/distutils/sysconfig.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
index d57b915..4da3768 100644
--- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py
@@ -204,13 +204,15 @@ def parse_makefile(fn, g=None):
n = m.group(1)
if done.has_key(n):
after = value[m.end():]
- value = value[:m.start()] + done[n] + after
+ value = value[:m.start()] + str(done[n]) + after
if "$" in after:
notdone[name] = value
else:
try: value = string.atoi(value)
- except ValueError: pass
- done[name] = string.strip(value)
+ except ValueError:
+ done[name] = string.strip(value)
+ else:
+ done[name] = value
del notdone[name]
elif notdone.has_key(n):
# get it on a subsequent round
@@ -223,8 +225,10 @@ def parse_makefile(fn, g=None):
notdone[name] = value
else:
try: value = string.atoi(value)
- except ValueError: pass
- done[name] = string.strip(value)
+ except ValueError:
+ done[name] = string.strip(value)
+ else:
+ done[name] = value
del notdone[name]
else:
# bogus variable reference; just drop it since we can't deal