summaryrefslogtreecommitdiff
path: root/debian/patches/sysconfigdata.diff
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/sysconfigdata.diff')
-rw-r--r--debian/patches/sysconfigdata.diff76
1 files changed, 76 insertions, 0 deletions
diff --git a/debian/patches/sysconfigdata.diff b/debian/patches/sysconfigdata.diff
new file mode 100644
index 0000000..5387689
--- /dev/null
+++ b/debian/patches/sysconfigdata.diff
@@ -0,0 +1,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)
+