|
2 | 2 |
|
3 | 3 | import os
|
4 | 4 | import sys
|
| 5 | +import textwrap |
5 | 6 | from os.path import pardir, realpath
|
6 | 7 |
|
7 | 8 | __all__ = [
|
@@ -514,11 +515,30 @@ def _generate_posix_vars():
|
514 | 515 | os.makedirs(pybuilddir, exist_ok=True)
|
515 | 516 | destfile = os.path.join(pybuilddir, name + '.py')
|
516 | 517 |
|
| 518 | + replacement = """ |
| 519 | + keys_to_replace = [ |
| 520 | + 'BINDIR', 'BINLIBDEST', 'CONFINCLUDEDIR', |
| 521 | + 'CONFINCLUDEPY', 'DESTDIRS', 'DESTLIB', 'DESTSHARED', |
| 522 | + 'INCLDIRSTOMAKE', 'INCLUDEDIR', 'INCLUDEPY', |
| 523 | + 'LIBDEST', 'LIBDIR', 'LIBPC', 'LIBPL', 'MACHDESTLIB', |
| 524 | + 'MANDIR', 'SCRIPTDIR', 'datarootdir', 'exec_prefix', |
| 525 | + 'TZPATH', |
| 526 | + ] |
| 527 | +
|
| 528 | + prefix = build_time_vars['BINDIR'][:-4] |
| 529 | +
|
| 530 | + for key in keys_to_replace: |
| 531 | + value = build_time_vars[key] |
| 532 | + build_time_vars[key] = value.replace(prefix, sys.prefix) |
| 533 | + """ |
| 534 | + |
517 | 535 | with open(destfile, 'w', encoding='utf8') as f:
|
| 536 | + f.write('import sys\n') |
518 | 537 | f.write('# system configuration generated and used by'
|
519 | 538 | ' the sysconfig module\n')
|
520 | 539 | f.write('build_time_vars = ')
|
521 | 540 | pprint.pprint(vars, stream=f)
|
| 541 | + f.write('\n%s' % textwrap.dedent(replacement)) |
522 | 542 |
|
523 | 543 | # Create file used for sys.path fixup -- see Modules/getpath.c
|
524 | 544 | with open('pybuilddir.txt', 'w', encoding='utf8') as f:
|
|
0 commit comments