--- Python-3.4.1/Lib/sysconfig.py.orig 2014-07-11 17:44:46.227699804 +0100 +++ Python-3.4.1/Lib/sysconfig.py 2014-07-11 19:09:01.000000000 +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)