Blob Blame History Raw
diff -rupN Python-2.7.13/Lib/sysconfig.py Python-2.7.13-new/Lib/sysconfig.py
--- Python-2.7.13/Lib/sysconfig.py	2016-12-17 21:05:06.000000000 +0100
+++ Python-2.7.13-new/Lib/sysconfig.py	2017-01-21 01:46:03.914635229 +0100
@@ -231,6 +231,7 @@ def _parse_makefile(filename, vars=None)
                     done[n] = v
 
     # do variable interpolation here
+    done['prefix']='${SYS_PREFIX}'
     while notdone:
         for name in notdone.keys():
             value = notdone[name]
@@ -346,6 +347,19 @@ def _generate_posix_vars():
         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, 'wb') 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') as f:
         f.write(pybuilddir)