summaryrefslogtreecommitdiffstats
path: root/Lib/sysconfig.py
diff options
context:
space:
mode:
authorTrent Nelson <trent@trent.me>2012-10-16 12:17:11 (GMT)
committerTrent Nelson <trent@trent.me>2012-10-16 12:17:11 (GMT)
commitb16269e375ec3b9dd656d64469f3810b4a0eec81 (patch)
tree3be912ed70d0a7bd5114f134f89bb2de01cde646 /Lib/sysconfig.py
parent744faddae87edec1612fa43606d9549f38c944f6 (diff)
parentc101bf32c4011a3c7f3249b8c15bcf95b944095b (diff)
downloadcpython-b16269e375ec3b9dd656d64469f3810b4a0eec81.zip
cpython-b16269e375ec3b9dd656d64469f3810b4a0eec81.tar.gz
cpython-b16269e375ec3b9dd656d64469f3810b4a0eec81.tar.bz2
Merge issue #15298: ensure _sysconfigdata is generated in build directory,
not source directory. Patch by: Richard Oudkerk (sbt).
Diffstat (limited to 'Lib/sysconfig.py')
-rw-r--r--Lib/sysconfig.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py
index d1b5824..d2870a7 100644
--- a/Lib/sysconfig.py
+++ b/Lib/sysconfig.py
@@ -371,13 +371,22 @@ def _generate_posix_vars():
if _PYTHON_BUILD:
vars['LDSHARED'] = vars['BLDSHARED']
- destfile = os.path.join(os.path.dirname(__file__), '_sysconfigdata.py')
+ pybuilddir = 'build/lib.%s-%s' % (get_platform(), sys.version[:3])
+ if hasattr(sys, "gettotalrefcount"):
+ pybuilddir += '-pydebug'
+ os.makedirs(pybuilddir, exist_ok=True)
+ destfile = os.path.join(pybuilddir, '_sysconfigdata.py')
+
with open(destfile, 'w', encoding='utf8') as f:
f.write('# system configuration generated and used by'
' the sysconfig module\n')
f.write('build_time_vars = ')
pprint.pprint(vars, stream=f)
+ # Create file used for sys.path fixup -- see Modules/getpath.c
+ with open('pybuilddir.txt', 'w', encoding='ascii') as f:
+ f.write(pybuilddir)
+
def _init_posix(vars):
"""Initialize the module as appropriate for POSIX systems."""
# _sysconfigdata is generated at build time, see _generate_posix_vars()