kumquat-buildroot/package/python3/0002-Change-the-install-location-of-_sysconfigdata.py.patch
Thomas Petazzoni 63aeae6538 python3: refresh Git formatted patches
This refreshes the set of python3 patches so they apply cleanly on the
v3.5.2 tag of cpython Github repository.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2017-03-09 22:35:30 +01:00

87 lines
3.6 KiB
Diff

From 1fca2c29a600b1eaa28da19e8c258fa0300c4eaf Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date: Wed, 23 Dec 2015 11:29:04 +0100
Subject: [PATCH] Change the install location of _sysconfigdata.py
The _sysconfigdata.py module contains definitions that are needed when
building Python modules. In cross-compilation mode, when building
Python extensions for the target, we need to use the _sysconfigdata.py
of the target Python while executing the host Python.
However until now, the _sysconfigdata.py module was installed in
build/lib.<arch>-<version> directory, together with a number of
architecture-specific shared objects, which cannot be used with the
host Python.
To solve this problem, this patch moves _sysconfigdata.py to a
separate location, build/sysconfigdata.<arch>-<version>/, and only
this directory gets added to the PYTHONPATH of the host Python
interpreter when building Python modules for the target.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
Makefile.pre.in | 12 ++++++++++--
configure.ac | 2 +-
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 87528a0..5a258e0 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -588,6 +588,9 @@ pybuilddir.txt: $(BUILDPYTHON)
rm -f ./pybuilddir.txt ; \
exit 1 ; \
fi
+ echo `cat pybuilddir.txt`/sysconfigdata > pysysconfigdatadir.txt
+ mkdir -p `cat pysysconfigdatadir.txt`
+ cp `cat pybuilddir.txt`/_sysconfigdata.py `cat pysysconfigdatadir.txt`
# This is shared by the math and cmath modules
Modules/_math.o: Modules/_math.c Modules/_math.h
@@ -1261,7 +1264,7 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
else true; \
fi; \
done
- @for i in $(srcdir)/Lib/*.py `cat pybuilddir.txt`/_sysconfigdata.py; \
+ @for i in $(srcdir)/Lib/*.py ; \
do \
if test -x $$i; then \
$(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
@@ -1271,6 +1274,11 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
echo $(INSTALL_DATA) $$i $(LIBDEST); \
fi; \
done
+ $(INSTALL_DATA) `cat pysysconfigdatadir.txt`/_sysconfigdata.py \
+ $(DESTDIR)$(LIBDEST)
+ mkdir -p $(DESTDIR)$(LIBDEST)/sysconfigdata
+ $(INSTALL_DATA) `cat pysysconfigdatadir.txt`/_sysconfigdata.py \
+ $(DESTDIR)$(LIBDEST)/sysconfigdata
@for d in $(LIBSUBDIRS); \
do \
a=$(srcdir)/Lib/$$d; \
@@ -1606,7 +1614,7 @@ clean: pycremoval
find build -name 'fficonfig.h' -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 pybuilddir.txt pysysconfigdatadir.txt
-rm -f Lib/lib2to3/*Grammar*.pickle
-rm -f Programs/_testembed Programs/_freeze_importlib
-rm -rf build
diff --git a/configure.ac b/configure.ac
index 1c07c05..8d0a43b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -71,7 +71,7 @@ if test "$cross_compiling" = yes; then
AC_MSG_ERROR([python$PACKAGE_VERSION interpreter not found])
fi
AC_MSG_RESULT($interp)
- PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/$(PLATDIR) '$interp
+ PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pysysconfigdatadir.txt && echo $(abs_builddir)/`cat pysysconfigdatadir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/$(PLATDIR) '$interp
fi
elif test "$cross_compiling" = maybe; then
AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH])
--
2.7.4