Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
ee528ccc
Commit
ee528ccc
authored
Oct 17, 2012
by
Trent Nelson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #15298: fix an OS X bootstrap issue with _sysconfigdata.py.
Reported by: Ned Deily.
parent
547298c9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
6 deletions
+19
-6
Lib/sysconfig.py
Lib/sysconfig.py
+19
-6
No files found.
Lib/sysconfig.py
View file @
ee528ccc
...
...
@@ -390,18 +390,31 @@ def _generate_posix_vars():
if _PYTHON_BUILD:
vars['LDSHARED'] = vars['BLDSHARED']
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')
# There's a chicken-and-egg situation on OS X with regards to the
# _sysconfigdata module after the changes introduced by #15298:
# get_config_vars() is called by get_platform() as part of the
# `make pybuilddir.txt` target -- which is a precursor to the
# _sysconfigdata.py module being constructed. Unfortunately,
# get_config_vars() eventually calls _init_posix(), which attempts
# to import _sysconfigdata, which we won't have built yet. So,
# write out _sysconfigdata.py to the current directory first,
# then call get_platform() to get the pybuilddir, then move it.
destfile = '_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)
pybuilddir = 'build/lib.%s-%s' % (get_platform(), sys.version[:3])
if hasattr(sys, "
gettotalrefcount
"):
pybuilddir += '-pydebug'
os.makedirs(pybuilddir, exist_ok=True)
target = os.path.join(pybuilddir, destfile)
# Relocate _sysconfigdata.py into its final home.
os.rename(destfile, target)
# Create file used for sys.path fixup -- see Modules/getpath.c
with open('pybuilddir.txt', 'w', encoding='ascii') as f:
f.write(pybuilddir)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment