Files
MINGW-packages/mingw-w64-python3/0000-make-_sysconfigdata.py-relocatable.patch
2018-04-16 10:51:53 +03:00

32 lines
1.3 KiB
Diff

diff -Naur Python-3.6.5-orig/Lib/sysconfig.py Python-3.6.5/Lib/sysconfig.py
--- Python-3.6.5-orig/Lib/sysconfig.py 2018-03-28 12:19:31.000000000 +0300
+++ Python-3.6.5/Lib/sysconfig.py 2018-04-16 09:52:56.756702300 +0300
@@ -257,6 +257,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]
@@ -410,6 +411,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)