Files
MINGW-packages/mingw-w64-python2/0000-make-_sysconfigdata.py-relocatable.patch

32 lines
1.1 KiB
Diff

diff -urN a/Lib/sysconfig.py b/Lib/sysconfig.py
--- a/Lib/sysconfig.py 2014-06-30 03:05:31.000000000 +0100
+++ b/Lib/sysconfig.py 2014-10-11 22:39:33.953224000 +0100
@@ -231,6 +231,7 @@
done[n] = v
# do variable interpolation here
+ done['prefix']='${SYS_PREFIX}'
while notdone:
for name in notdone.keys():
value = notdone[name]
@@ -342,6 +343,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, '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)