diff -urN a/Lib/sysconfig.py b/Lib/sysconfig.py --- a/Lib/sysconfig.py 2014-10-08 09:18:12.000000000 +0100 +++ b/Lib/sysconfig.py 2014-10-11 14:18:33.073762000 +0100 @@ -264,6 +264,7 @@ # if the expansion uses the name without a prefix. renamed_variables = ('CFLAGS', 'LDFLAGS', 'CPPFLAGS') + done['prefix']='${SYS_PREFIX}' while len(variables) > 0: for name in tuple(variables): value = notdone[name] @@ -400,6 +401,19 @@ f.write('build_time_vars = ') pprint.pprint(vars, stream=f) + # Now reload the file and replace: + replacements = {": '${SYS_PREFIX}'" : ": sys.prefix", + ": '${SYS_PREFIX}" : ": sys.prefix + '", + "${SYS_PREFIX}'" : "' + sys.prefix", + "${SYS_PREFIX}" : "' + sys.prefix + '"} + + contents = open(destfile).read() + for rep in replacements.keys(): + contents = contents.replace(rep, replacements[rep]) + with open(destfile, 'w', encoding='utf8') as f: + f.write('import sys\n') + f.write(contents) + # Create file used for sys.path fixup -- see Modules/getpath.c with open('pybuilddir.txt', 'w', encoding='ascii') as f: f.write(pybuilddir)