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
c101bf32
Commit
c101bf32
authored
Oct 16, 2012
by
Trent Nelson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #15298: ensure _sysconfigdata is generated in build directory,
not source directory. Patch by Richard Oudkerk (sbt).
parent
8a420227
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
28 deletions
+28
-28
Lib/sysconfig.py
Lib/sysconfig.py
+10
-1
Makefile.pre.in
Makefile.pre.in
+13
-11
Misc/NEWS
Misc/NEWS
+5
-2
setup.py
setup.py
+0
-14
No files found.
Lib/sysconfig.py
View file @
c101bf32
...
...
@@ -390,13 +390,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()
...
...
Makefile.pre.in
View file @
c101bf32
...
...
@@ -410,8 +410,6 @@ OBJECT_OBJS= \
Objects/unicodectype.o
\
Objects/weakrefobject.o
SYSCONFIGDATA
=
$(srcdir)
/Lib/_sysconfigdata.py
##########################################################################
# objects that get linked into the Python library
LIBRARY_OBJS_OMIT_FROZEN
=
\
...
...
@@ -432,7 +430,7 @@ LIBRARY_OBJS= \
# Default target
all
:
build_all
build_all
:
$(BUILDPYTHON)
$(SYSCONFIGDATA)
oldsharedmods sharedmods gdbhooks Modules/_testembed
build_all
:
$(BUILDPYTHON) oldsharedmods sharedmods gdbhooks Modules/_testembed
# Compile a binary with gcc profile guided optimization.
profile-opt
:
...
...
@@ -466,17 +464,19 @@ coverage:
$(BUILDPYTHON)
:
Modules/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY)
$(LINKCC)
$(PY_LDFLAGS)
$(LINKFORSHARED)
-o
$@
Modules/python.o
$(BLDLIBRARY)
$(LIBS)
$(MODLIBS)
$(SYSLIBS)
$(LDLAST)
platform
:
$(BUILDPYTHON)
$(SYSCONFIGDATA)
platform
:
$(BUILDPYTHON)
pybuilddir.txt
$(RUNSHARED)
$(PYTHON_FOR_BUILD)
-c
'import sys ; from sysconfig import get_platform ; print(get_platform()+"-"+sys.version[0:3])'
>
platform
# Generate the sysconfig build-time data
$(SYSCONFIGDATA)
:
$(BUILDPYTHON)
# Create build directory and generate the sysconfig build-time data there.
# pybuilddir.txt contains the name of the build dir and is used for
# sys.path fixup -- see Modules/getpath.c.
pybuilddir.txt
:
$(BUILDPYTHON)
$(RUNSHARED)
$(PYTHON_FOR_BUILD)
-S
-m
sysconfig
--generate-posix-vars
# Build the shared modules
# MAKEFLAGS are sorted and normalized. Under GNU make the 's' for
# -s, --silent or --quiet is always the first char.
sharedmods
:
$(BUILDPYTHON)
$(SYSCONFIGDATA)
sharedmods
:
$(BUILDPYTHON)
pybuilddir.txt
@
case
"
$$
MAKEFLAGS"
in
\
s
*
)
quiet
=
"-q"
;;
\
*
)
quiet
=
""
;;
\
...
...
@@ -1043,7 +1043,7 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
else
true
;
\
fi
;
\
done
@
for
i
in
$(srcdir)
/Lib/
*
.py
;
\
@
for
i
in
$(srcdir)
/Lib/
*
.py
`
cat
pybuilddir.txt
`
/_sysconfigdata.py
;
\
do
\
if
test
-x
$$
i
;
then
\
$(INSTALL_SCRIPT)
$$
i
$(DESTDIR)$(LIBDEST)
;
\
...
...
@@ -1203,6 +1203,8 @@ sharedinstall: sharedmods
--install-scripts
=
$(BINDIR)
\
--install-platlib
=
$(DESTSHARED)
\
--root
=
$(DESTDIR)
/
-
rm
$(DESTDIR)$(DESTSHARED)
/_sysconfigdata.py
-
rm
-r
$(DESTDIR)$(DESTSHARED)
/__pycache__
# Here are a couple of targets for MacOSX again, to install a full
# framework-based Python. frameworkinstall installs everything, the
...
...
@@ -1348,9 +1350,10 @@ clean: pycremoval
find
.
-name
'*.s[ol]'
-exec
rm
-f
{}
';'
find
.
-name
'*.so.[0-9]*.[0-9]*'
-exec
rm
-f
{}
';'
find build
-name
'fficonfig.h'
-exec
rm
-f
{}
';'
||
true
find build
-name
'fficonfig.py'
-exec
rm
-f
{}
';'
||
true
find build
-name
'*.py'
-exec
rm
-f
{}
';'
||
true
find build
-name
'*.py[co]'
-exec
rm
-f
{}
';'
||
true
-
rm
-f
pybuilddir.txt
-
rm
-f
Lib/lib2to3/
*
Grammar
*
.pickle
-
rm
-f
$(SYSCONFIGDATA)
-
rm
-f
Modules/_testembed Modules/_freeze_importlib
profile-removal
:
...
...
@@ -1374,7 +1377,6 @@ distclean: clobber
Modules/Setup Modules/Setup.local Modules/Setup.config
\
Modules/ld_so_aix Modules/python.exp Misc/python.pc
-
rm
-f
python
*
-gdb
.py
-
rm
-f
pybuilddir.txt
find
$(srcdir)
'('
-name
'*.fdc'
-o
-name
'*~'
\
-o
-name
'[@,#]*'
-o
-name
'*.old'
\
-o
-name
'*.orig'
-o
-name
'*.rej'
\
...
...
Misc/NEWS
View file @
c101bf32
...
...
@@ -127,6 +127,9 @@ Tests
Build
-----
-
Issue
#
15298
:
ensure
_sysconfigdata
is
generated
in
build
directory
,
not
source
directory
.
-
Issue
#
15833
:
Fix
a
regression
in
3.3
that
resulted
in
exceptions
being
raised
if
importlib
failed
to
write
byte
-
compiled
files
.
This
affected
attempts
to
build
Python
out
-
of
-
tree
from
a
read
-
only
source
directory
.
...
...
@@ -134,8 +137,8 @@ Build
-
Issue
#
15923
:
Fix
a
mistake
in
``
asdl_c
.
py
``
that
resulted
in
a
TypeError
after
2801
bf875a24
(
see
#
15801
).
-
Issue
#
15819
:
Make
sure
we
can
build
Python
out
-
of
-
tree
from
a
read
only
source
directory
.
(
Somewhat
related
to
issue
#
9860.
)
-
Issue
#
15819
:
Make
sure
we
can
build
Python
out
-
of
-
tree
from
a
read
-
only
source
directory
.
(
Somewhat
related
to
issue
#
9860.
)
Documentation
-------------
...
...
setup.py
View file @
c101bf32
...
...
@@ -33,10 +33,6 @@ COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_AR
# This global variable is used to hold the list of modules to be disabled.
disabled_module_list
=
[]
# File which contains the directory for shared mods (for sys.path fixup
# when running from the build dir, see Modules/getpath.c)
_BUILDDIR_COOKIE
=
"pybuilddir.txt"
def
add_dir_to_list
(
dirlist
,
dir
):
"""Add the directory 'dir' to the list 'dirlist' (after any relative
directories) if:
...
...
@@ -252,16 +248,6 @@ class PyBuildExt(build_ext):
args
[
'compiler_so'
]
=
compiler
+
' '
+
ccshared
+
' '
+
cflags
self
.
compiler
.
set_executables
(
**
args
)
# Not only do we write the builddir cookie, but we manually install
# the shared modules directory if it isn't already in sys.path.
# Otherwise trying to import the extensions after building them
# will fail.
with
open
(
_BUILDDIR_COOKIE
,
"wb"
)
as
f
:
f
.
write
(
self
.
build_lib
.
encode
(
'utf-8'
,
'surrogateescape'
))
abs_build_lib
=
os
.
path
.
join
(
os
.
getcwd
(),
self
.
build_lib
)
if
abs_build_lib
not
in
sys
.
path
:
sys
.
path
.
append
(
abs_build_lib
)
build_ext
.
build_extensions
(
self
)
longest
=
max
([
len
(
e
.
name
)
for
e
in
self
.
extensions
])
...
...
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