1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
# DP: Issue #15298: Generate _sysconfigdata.py in the build dir, not the source dir.
diff -r 2ecdda96f970 Lib/sysconfig.py
--- a/Lib/sysconfig.py Tue Jul 10 18:27:54 2012 +0200
+++ b/Lib/sysconfig.py Tue Jul 10 22:06:43 2012 +0200
@@ -390,7 +390,7 @@
if _PYTHON_BUILD:
vars['LDSHARED'] = vars['BLDSHARED']
- destfile = os.path.join(os.path.dirname(__file__), '_sysconfigdata.py')
+ destfile = '_sysconfigdata.py'
with open(destfile, 'w', encoding='utf8') as f:
f.write('# system configuration generated and used by'
' the sysconfig module\n')
diff -r 2ecdda96f970 Makefile.pre.in
--- a/Makefile.pre.in Tue Jul 10 18:27:54 2012 +0200
+++ b/Makefile.pre.in Tue Jul 10 22:06:43 2012 +0200
@@ -410,7 +410,7 @@
Objects/unicodectype.o \
Objects/weakrefobject.o
-SYSCONFIGDATA=$(srcdir)/Lib/_sysconfigdata.py
+SYSCONFIGDATA=_sysconfigdata.py
##########################################################################
# objects that get linked into the Python library
@@ -472,6 +472,9 @@
# Generate the sysconfig build-time data
$(SYSCONFIGDATA): $(BUILDPYTHON)
$(RUNSHARED) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars
+ $(RUNSHARED) $(PYTHON_FOR_BUILD) -S -c 'import os,sys ; from distutils.util import get_platform ; d=os.path.join("build", "lib."+get_platform()+"-"+sys.version[0:3]+("-pydebug" if hasattr(sys, "gettotalrefcount") else "")); print(d, end="")' > pybuilddir.txt
+ mkdir -p `cat pybuilddir.txt`
+ cp $(SYSCONFIGDATA) `cat pybuilddir.txt`/.
# Build the shared modules
sharedmods: $(BUILDPYTHON) $(SYSCONFIGDATA)
@@ -1036,7 +1039,7 @@
else true; \
fi; \
done
- @for i in $(srcdir)/Lib/*.py ; \
+ @for i in $(srcdir)/Lib/*.py $(SYSCONFIGDATA); \
do \
if test -x $$i; then \
$(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
diff -r 2ecdda96f970 setup.py
--- a/setup.py Tue Jul 10 18:27:54 2012 +0200
+++ b/setup.py Tue Jul 10 22:06:43 2012 +0200
@@ -33,10 +33,6 @@
# 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:
@@ -250,12 +246,9 @@
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'))
+ # 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.
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)
|