summaryrefslogtreecommitdiffstats
path: root/patches/Python-2.7.16
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2019-03-27 09:29:53 +0100
committerMichael Olbrich <m.olbrich@pengutronix.de>2019-03-27 09:29:56 +0100
commit2b5632650f577d2332ad6dcef0350a8df9b5b30a (patch)
tree5c249a84cd85a967d263cd5fd5147c7cf2bce848 /patches/Python-2.7.16
parenteccd4e7a6807805332b2db0fa301607c85ba4386 (diff)
downloadptxdist-2b5632650f577d2332ad6dcef0350a8df9b5b30a.tar.gz
ptxdist-2b5632650f577d2332ad6dcef0350a8df9b5b30a.tar.xz
python: version bump 2.7.15 -> 2.7.16
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'patches/Python-2.7.16')
-rw-r--r--patches/Python-2.7.16/0001-Add-support-for-socketcan-to-the-python-socket-modul.patch224
-rw-r--r--patches/Python-2.7.16/0002-use-AC_CHECK_SIZEOF-rather-than-AC_TRY_COMPILE-for-l.patch37
-rw-r--r--patches/Python-2.7.16/0003-use-AC_TYPE_LONG_DOUBLE-to-detect-long-double-suppor.patch35
-rw-r--r--patches/Python-2.7.16/0004-setup.py-don-t-leak-host-path-into-cross-compilation.patch27
-rw-r--r--patches/Python-2.7.16/0005-add-cross-compilation-support.patch61
-rw-r--r--patches/Python-2.7.16/0006-python-don-t-add-rpaths-in-setup.py.patch31
-rw-r--r--patches/Python-2.7.16/0007-add-more-search-paths.patch28
-rw-r--r--patches/Python-2.7.16/0008-resolve-existing-LD_LIBRARY_PATH-during-make-not-dur.patch25
-rw-r--r--patches/Python-2.7.16/0009-python2-prevent-host-path-leakage.patch39
-rwxr-xr-xpatches/Python-2.7.16/autogen.sh14
-rw-r--r--patches/Python-2.7.16/series12
11 files changed, 533 insertions, 0 deletions
diff --git a/patches/Python-2.7.16/0001-Add-support-for-socketcan-to-the-python-socket-modul.patch b/patches/Python-2.7.16/0001-Add-support-for-socketcan-to-the-python-socket-modul.patch
new file mode 100644
index 000000000..65366650e
--- /dev/null
+++ b/patches/Python-2.7.16/0001-Add-support-for-socketcan-to-the-python-socket-modul.patch
@@ -0,0 +1,224 @@
+From: Michael Olbrich <m.olbrich@pengutronix.de>
+Date: Tue, 5 May 2009 15:17:20 +0200
+Subject: [PATCH] Add support for socketcan to the python socket module
+
+This patch add support for the protocol family AF_CAN. It contains all the
+necessary code to use the python socket module for socketcan.
+
+Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
+Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
+---
+ Lib/plat-linux2/IN.py | 2 ++
+ Modules/socketmodule.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++
+ Modules/socketmodule.h | 11 +++++++
+ configure.ac | 13 ++++++++
+ 4 files changed, 115 insertions(+)
+
+diff --git a/Lib/plat-linux2/IN.py b/Lib/plat-linux2/IN.py
+index ad307f65398b..f72ae886cad8 100644
+--- a/Lib/plat-linux2/IN.py
++++ b/Lib/plat-linux2/IN.py
+@@ -384,6 +384,7 @@ PF_SNA = 22
+ PF_IRDA = 23
+ PF_PPPOX = 24
+ PF_WANPIPE = 25
++PF_CAN = 29
+ PF_BLUETOOTH = 31
+ PF_MAX = 32
+ AF_UNSPEC = PF_UNSPEC
+@@ -414,6 +415,7 @@ AF_SNA = PF_SNA
+ AF_IRDA = PF_IRDA
+ AF_PPPOX = PF_PPPOX
+ AF_WANPIPE = PF_WANPIPE
++AF_CAN = PF_CAN
+ AF_BLUETOOTH = PF_BLUETOOTH
+ AF_MAX = PF_MAX
+ SOL_RAW = 255
+diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
+index 8d3670529e85..f1c0bab247b0 100644
+--- a/Modules/socketmodule.c
++++ b/Modules/socketmodule.c
+@@ -448,6 +448,10 @@ const char *inet_ntop(int af, const void *src, char *dst, socklen_t size);
+
+ #define SAS2SA(x) ((struct sockaddr *)(x))
+
++#ifdef ENABLE_CAN
++#include <linux/can/raw.h>
++#endif
++
+ /*
+ * Constants for getnameinfo()
+ */
+@@ -1125,6 +1129,22 @@ makesockaddr(int sockfd, struct sockaddr *addr, int addrlen, int proto)
+ }
+ #endif /* ENABLE_IPV6 */
+
++#ifdef ENABLE_CAN
++ case AF_CAN:
++ {
++ struct sockaddr_can *a = (struct sockaddr_can *)addr;
++ char *ifname = "";
++ struct ifreq ifr;
++ /* need to look up interface name give index */
++ if (a->can_ifindex) {
++ ifr.ifr_ifindex = a->can_ifindex;
++ if (ioctl(sockfd, SIOCGIFNAME, &ifr) == 0)
++ ifname = ifr.ifr_name;
++ }
++ return Py_BuildValue("s", ifname);
++ }
++#endif
++
+ #ifdef USE_BLUETOOTH
+ case AF_BLUETOOTH:
+ switch (proto) {
+@@ -1411,6 +1431,28 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
+ }
+ #endif /* ENABLE_IPV6 */
+
++#ifdef ENABLE_CAN
++ case AF_CAN:
++ {
++ struct sockaddr_can* addr;
++ struct ifreq ifr;
++ char *interfaceName;
++ addr = (struct sockaddr_can*)addr_ret;
++ if (!PyArg_Parse(args, "s", &interfaceName))
++ return 0;
++ strncpy(ifr.ifr_name, interfaceName, sizeof(ifr.ifr_name));
++ ifr.ifr_name[(sizeof(ifr.ifr_name))-1] = '\0';
++ if (ioctl(s->sock_fd, SIOCGIFINDEX, &ifr) < 0) {
++ s->errorhandler();
++ return 0;
++ }
++ addr->can_family = AF_CAN;
++ addr->can_ifindex = ifr.ifr_ifindex;
++ *len_ret = sizeof *addr;
++ return 1;
++ }
++#endif
++
+ #ifdef USE_BLUETOOTH
+ case AF_BLUETOOTH:
+ {
+@@ -1662,6 +1704,14 @@ getsockaddrlen(PySocketSockObject *s, socklen_t *len_ret)
+ }
+ #endif /* ENABLE_IPV6 */
+
++#ifdef ENABLE_CAN
++ case AF_CAN:
++ {
++ *len_ret = sizeof (struct sockaddr_can);
++ return 1;
++ }
++#endif
++
+ #ifdef USE_BLUETOOTH
+ case AF_BLUETOOTH:
+ {
+@@ -4798,6 +4848,10 @@ init_socket(void)
+ PyModule_AddIntConstant(m, "AF_LLC", AF_LLC);
+ #endif
+
++#ifdef ENABLE_CAN
++ PyModule_AddIntConstant(m, "AF_CAN", AF_CAN);
++#endif
++
+ #ifdef USE_BLUETOOTH
+ PyModule_AddIntConstant(m, "AF_BLUETOOTH", AF_BLUETOOTH);
+ PyModule_AddIntConstant(m, "BTPROTO_L2CAP", BTPROTO_L2CAP);
+@@ -5154,6 +5208,41 @@ init_socket(void)
+ PyModule_AddIntConstant(m, "IPPROTO_MAX", IPPROTO_MAX);
+ #endif
+
++#ifdef CAN_RAW
++ PyModule_AddIntConstant(m, "CAN_RAW", CAN_RAW);
++#endif
++#ifdef CAN_BCM
++ PyModule_AddIntConstant(m, "CAN_BCM", CAN_BCM);
++#endif
++#ifdef CAN_TP16
++ PyModule_AddIntConstant(m, "CAN_TP16", CAN_TP16);
++#endif
++#ifdef CAN_TP20
++ PyModule_AddIntConstant(m, "CAN_TP20", CAN_TP20);
++#endif
++#ifdef CAN_MCNET
++ PyModule_AddIntConstant(m, "CAN_MCNET", CAN_MCNET);
++#endif
++#ifdef CAN_ISOTP
++ PyModule_AddIntConstant(m, "CAN_ISOTP", CAN_ISOTP);
++#endif
++#ifdef CAN_NPROTO
++ PyModule_AddIntConstant(m, "CAN_NPROTO", CAN_NPROTO);
++#endif
++
++#ifdef SOL_CAN_BASE
++ PyModule_AddIntConstant(m, "SOL_CAN_BASE", SOL_CAN_BASE);
++#endif
++#ifdef SOL_CAN_RAW
++ PyModule_AddIntConstant(m, "SOL_CAN_RAW", SOL_CAN_RAW);
++#endif
++#ifdef ENABLE_CAN
++ PyModule_AddIntConstant(m, "CAN_RAW_FILTER", CAN_RAW_FILTER);
++ PyModule_AddIntConstant(m, "CAN_RAW_ERR_FILTER", CAN_RAW_ERR_FILTER);
++ PyModule_AddIntConstant(m, "CAN_RAW_LOOPBACK", CAN_RAW_LOOPBACK);
++ PyModule_AddIntConstant(m, "CAN_RAW_RECV_OWN_MSGS", CAN_RAW_RECV_OWN_MSGS);
++#endif
++
+ /* Some port configuration */
+ #ifdef IPPORT_RESERVED
+ PyModule_AddIntConstant(m, "IPPORT_RESERVED", IPPORT_RESERVED);
+diff --git a/Modules/socketmodule.h b/Modules/socketmodule.h
+index d98e00e88d27..3b6e22e29d3a 100644
+--- a/Modules/socketmodule.h
++++ b/Modules/socketmodule.h
+@@ -55,6 +55,14 @@ typedef int socklen_t;
+ #include <bluetooth/hci.h>
+ #endif
+
++#define AF_CAN 29
++#define PF_CAN AF_CAN
++
++#ifdef HAVE_LINUX_CAN_H
++#define ENABLE_CAN 1
++#include <linux/can.h>
++#endif
++
+ #ifdef HAVE_BLUETOOTH_H
+ #include <bluetooth.h>
+ #endif
+@@ -106,6 +114,9 @@ typedef union sock_addr {
+ struct sockaddr_in6 in6;
+ struct sockaddr_storage storage;
+ #endif
++#ifdef ENABLE_CAN
++ struct sockaddr_can can;
++#endif
+ #ifdef HAVE_BLUETOOTH_BLUETOOTH_H
+ struct sockaddr_l2 bt_l2;
+ struct sockaddr_rc bt_rc;
+diff --git a/configure.ac b/configure.ac
+index 913d5469d06e..675f56835e59 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1746,6 +1746,19 @@ AC_CHECK_HEADERS(linux/netlink.h,,,[
+ #endif
+ ])
+
++AC_CHECK_HEADERS(linux/can.h,[],[],[#include <sys/socket.h>])
++# check for AF_CAN
++AC_TRY_COMPILE(
++ [[#include <sys/socket.h>
++ int domain = AF_CAN;]],
++ [[socket(domain, 0, 0);]],
++ [],
++ [
++ AC_DEFINE(AF_CAN, 29, [Define AF_CAN if not defined by sys/socket.h])
++ AC_DEFINE(PF_CAN, 29, [Define PF_CAN if not defined by sys/socket.h])
++ ]
++)
++
+ # checks for typedefs
+ was_it_defined=no
+ AC_MSG_CHECKING(for clock_t in time.h)
diff --git a/patches/Python-2.7.16/0002-use-AC_CHECK_SIZEOF-rather-than-AC_TRY_COMPILE-for-l.patch b/patches/Python-2.7.16/0002-use-AC_CHECK_SIZEOF-rather-than-AC_TRY_COMPILE-for-l.patch
new file mode 100644
index 000000000..58058cfde
--- /dev/null
+++ b/patches/Python-2.7.16/0002-use-AC_CHECK_SIZEOF-rather-than-AC_TRY_COMPILE-for-l.patch
@@ -0,0 +1,37 @@
+From: Marc Kleine-Budde <mkl@pengutronix.de>
+Date: Fri, 24 Apr 2009 18:44:11 +0200
+Subject: [PATCH] use AC_CHECK_SIZEOF rather than AC_TRY_COMPILE for long long
+ detection
+
+AC_CHECK_SIZEOF does first detect if the type is available and detects
+its size. Use it, rather than hand crafted function with AC_TRY_COMPILE.
+
+Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
+---
+ configure.ac | 12 ++++--------
+ 1 file changed, 4 insertions(+), 8 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 675f56835e59..c9cb9c802882 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1883,15 +1883,11 @@ AC_CHECK_SIZEOF(fpos_t, 4)
+ AC_CHECK_SIZEOF(size_t, 4)
+ AC_CHECK_SIZEOF(pid_t, 4)
+
+-AC_MSG_CHECKING(for long long support)
+-have_long_long=no
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[long long x; x = (long long)0;]])],[
+- AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.])
++AC_TYPE_LONG_LONG_INT
++AC_CHECK_SIZEOF(long long)
++if test "$ac_cv_type_long_long_int" = "yes" ; then
+ have_long_long=yes
+-],[])
+-AC_MSG_RESULT($have_long_long)
+-if test "$have_long_long" = yes ; then
+-AC_CHECK_SIZEOF(long long, 8)
++ AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.])
+ fi
+
+ AC_MSG_CHECKING(for long double support)
diff --git a/patches/Python-2.7.16/0003-use-AC_TYPE_LONG_DOUBLE-to-detect-long-double-suppor.patch b/patches/Python-2.7.16/0003-use-AC_TYPE_LONG_DOUBLE-to-detect-long-double-suppor.patch
new file mode 100644
index 000000000..f6c3f9143
--- /dev/null
+++ b/patches/Python-2.7.16/0003-use-AC_TYPE_LONG_DOUBLE-to-detect-long-double-suppor.patch
@@ -0,0 +1,35 @@
+From: Marc Kleine-Budde <mkl@pengutronix.de>
+Date: Fri, 24 Apr 2009 18:47:19 +0200
+Subject: [PATCH] use AC_TYPE_LONG_DOUBLE to detect long double support
+
+use the correct AC_TYPE_LONG_DOUBLE function rahter than hand crafted
+test to detect long double support.
+
+Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
+---
+ configure.ac | 12 ++----------
+ 1 file changed, 2 insertions(+), 10 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index c9cb9c802882..c89e4a601cf1 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1890,16 +1890,8 @@ if test "$ac_cv_type_long_long_int" = "yes" ; then
+ AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.])
+ fi
+
+-AC_MSG_CHECKING(for long double support)
+-have_long_double=no
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[long double x; x = (long double)0;]])],[
+- AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define this if you have the type long double.])
+- have_long_double=yes
+-],[])
+-AC_MSG_RESULT($have_long_double)
+-if test "$have_long_double" = yes ; then
+-AC_CHECK_SIZEOF(long double, 12)
+-fi
++AC_TYPE_LONG_DOUBLE
++AC_CHECK_SIZEOF(long double)
+
+ AC_MSG_CHECKING(for _Bool support)
+ have_c99_bool=no
diff --git a/patches/Python-2.7.16/0004-setup.py-don-t-leak-host-path-into-cross-compilation.patch b/patches/Python-2.7.16/0004-setup.py-don-t-leak-host-path-into-cross-compilation.patch
new file mode 100644
index 000000000..95a97e3f4
--- /dev/null
+++ b/patches/Python-2.7.16/0004-setup.py-don-t-leak-host-path-into-cross-compilation.patch
@@ -0,0 +1,27 @@
+From: Marc Kleine-Budde <mkl@pengutronix.de>
+Date: Tue, 28 Apr 2009 19:07:54 +0200
+Subject: [PATCH] setup.py: don't leak host path into cross compilation
+ environment
+
+During cross compilation we don't host path (neither include nor library
+search patch) to leak into our environment.
+
+Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
+---
+ setup.py | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/setup.py b/setup.py
+index 33cecc687573..521b6e77c234 100644
+--- a/setup.py
++++ b/setup.py
+@@ -1228,6 +1228,9 @@ class PyBuildExt(build_ext):
+ # the more recent berkeleydb's db.h file first in the include path
+ # when attempting to compile and it will fail.
+ f = "/usr/include/db.h"
++ if cross_compiling:
++ f = ''
++
+
+ if host_platform == 'darwin':
+ if is_macosx_sdk_path(f):
diff --git a/patches/Python-2.7.16/0005-add-cross-compilation-support.patch b/patches/Python-2.7.16/0005-add-cross-compilation-support.patch
new file mode 100644
index 000000000..79efeba4e
--- /dev/null
+++ b/patches/Python-2.7.16/0005-add-cross-compilation-support.patch
@@ -0,0 +1,61 @@
+From: Marc Kleine-Budde <mkl@pengutronix.de>
+Date: Mon, 4 May 2009 14:39:18 +0200
+Subject: [PATCH] add cross compilation support
+
+This patch adds preliminary cross compilation support to python.
+
+Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
+---
+ Makefile.pre.in | 12 ++++++++----
+ configure.ac | 7 +++++++
+ 2 files changed, 15 insertions(+), 4 deletions(-)
+
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+index 9297e7fc89c4..1400c8ca6f97 100644
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -88,6 +88,10 @@ CFLAGSFORSHARED=@CFLAGSFORSHARED@
+ # C flags used for building the interpreter object files
+ PY_CFLAGS= $(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
+
++# cross compiler options
++ifndef DESTDIR
++sysroot= @SYSROOT@
++endif
+
+ # Machine-dependent subdirectories
+ MACHDEP= @MACHDEP@
+@@ -106,11 +110,11 @@ datarootdir= @datarootdir@
+
+ # Expanded directories
+ BINDIR= @bindir@
+-LIBDIR= @libdir@
++LIBDIR= $(sysroot)@libdir@
+ MANDIR= @mandir@
+-INCLUDEDIR= @includedir@
+-CONFINCLUDEDIR= $(exec_prefix)/include
+-SCRIPTDIR= $(prefix)/lib
++INCLUDEDIR= $(sysroot)@includedir@
++CONFINCLUDEDIR= $(sysroot)$(exec_prefix)/include
++SCRIPTDIR= $(sysroot)$(prefix)/lib
+
+ # Detailed destination directories
+ BINLIBDEST= $(LIBDIR)/python$(VERSION)
+diff --git a/configure.ac b/configure.ac
+index c89e4a601cf1..863d7929507b 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -980,6 +980,13 @@ if test "$cross_compiling" = yes; then
+ RUNSHARED=
+ fi
+
++# sysroot
++AC_SUBST(SYSROOT)
++if test "$cross_compiling" = yes; then
++ AC_MSG_CHECKING([for SYSROOT])
++ AC_MSG_RESULT([$SYSROOT])
++fi
++
+ AC_MSG_RESULT($LDLIBRARY)
+
+ AC_PROG_RANLIB
diff --git a/patches/Python-2.7.16/0006-python-don-t-add-rpaths-in-setup.py.patch b/patches/Python-2.7.16/0006-python-don-t-add-rpaths-in-setup.py.patch
new file mode 100644
index 000000000..d9fa6fe92
--- /dev/null
+++ b/patches/Python-2.7.16/0006-python-don-t-add-rpaths-in-setup.py.patch
@@ -0,0 +1,31 @@
+From: Michael Olbrich <m.olbrich@pengutronix.de>
+Date: Sat, 27 May 2017 08:00:24 +0200
+Subject: [PATCH] python: don't add rpaths in setup.py
+
+We don't add rpaths.
+
+Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
+---
+ setup.py | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/setup.py b/setup.py
+index 521b6e77c234..213a4d969fbc 100644
+--- a/setup.py
++++ b/setup.py
+@@ -1101,7 +1101,6 @@ class PyBuildExt(build_ext):
+ exts.append(Extension('_bsddb', ['_bsddb.c'],
+ depends = ['bsddb.h'],
+ library_dirs=dblib_dir,
+- runtime_library_dirs=dblib_dir,
+ include_dirs=db_incs,
+ libraries=dblibs))
+ else:
+@@ -1318,7 +1317,6 @@ class PyBuildExt(build_ext):
+ print "building dbm using bdb"
+ dbmext = Extension('dbm', ['dbmmodule.c'],
+ library_dirs=dblib_dir,
+- runtime_library_dirs=dblib_dir,
+ include_dirs=db_incs,
+ define_macros=[
+ ('HAVE_BERKDB_H', None),
diff --git a/patches/Python-2.7.16/0007-add-more-search-paths.patch b/patches/Python-2.7.16/0007-add-more-search-paths.patch
new file mode 100644
index 000000000..3e6e234ee
--- /dev/null
+++ b/patches/Python-2.7.16/0007-add-more-search-paths.patch
@@ -0,0 +1,28 @@
+From: Michael Olbrich <m.olbrich@pengutronix.de>
+Date: Thu, 13 Jun 2013 10:42:58 +0200
+Subject: [PATCH] add more search paths
+
+Without this setup.py won't find libs in <sysroot>/lib
+
+Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
+---
+ setup.py | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/setup.py b/setup.py
+index 213a4d969fbc..4ce7075150d1 100644
+--- a/setup.py
++++ b/setup.py
+@@ -502,8 +502,10 @@ class PyBuildExt(build_ext):
+ # (PYTHONFRAMEWORK is set) to avoid # linking problems when
+ # building a framework with different architectures than
+ # the one that is currently installed (issue #7473)
+- add_dir_to_list(self.compiler.library_dirs,
+- sysconfig.get_config_var("LIBDIR"))
++ libdir = sysconfig.get_config_var("LIBDIR")
++ add_dir_to_list(self.compiler.library_dirs, libdir)
++ if libdir.endswith('/usr/lib'):
++ add_dir_to_list(self.compiler.library_dirs, libdir.replace('/usr/lib','/lib'))
+ add_dir_to_list(self.compiler.include_dirs,
+ sysconfig.get_config_var("INCLUDEDIR"))
+
diff --git a/patches/Python-2.7.16/0008-resolve-existing-LD_LIBRARY_PATH-during-make-not-dur.patch b/patches/Python-2.7.16/0008-resolve-existing-LD_LIBRARY_PATH-during-make-not-dur.patch
new file mode 100644
index 000000000..bd98f681c
--- /dev/null
+++ b/patches/Python-2.7.16/0008-resolve-existing-LD_LIBRARY_PATH-during-make-not-dur.patch
@@ -0,0 +1,25 @@
+From: Michael Olbrich <m.olbrich@pengutronix.de>
+Date: Wed, 5 Feb 2014 12:16:12 +0100
+Subject: [PATCH] resolve existing LD_LIBRARY_PATH during make, not during
+ configure
+
+Otherwise, calling "make install" with fakeroot may not work correctly.
+
+Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
+---
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 863d7929507b..661cd3dcb76c 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -926,7 +926,7 @@ if test $enable_shared = "yes"; then
+ Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*)
+ LDLIBRARY='libpython$(VERSION).so'
+ BLDLIBRARY='-L. -lpython$(VERSION)'
+- RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
++ RUNSHARED=LD_LIBRARY_PATH=`pwd`:'${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}'
+ case $ac_sys_system in
+ FreeBSD*)
+ SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
diff --git a/patches/Python-2.7.16/0009-python2-prevent-host-path-leakage.patch b/patches/Python-2.7.16/0009-python2-prevent-host-path-leakage.patch
new file mode 100644
index 000000000..ab5e0d42f
--- /dev/null
+++ b/patches/Python-2.7.16/0009-python2-prevent-host-path-leakage.patch
@@ -0,0 +1,39 @@
+From: Bastian Stender <bst@pengutronix.de>
+Date: Mon, 8 Jan 2018 15:55:40 +0100
+Subject: [PATCH] python2: prevent host path leakage
+
+If cross-compiling and host/target architecture match host paths are
+added to include_dirs and library_dirs in add_multiarch_paths() (e.g.
+/usr/lib/i386-linux-gnu, /usr/include/i386-linux-gnu). This leads to
+build failures for some extensions (at least _ssl and _socket).
+
+ptxdist does not support multiarch, so remove this addition when
+cross-compiling.
+
+Based on a patch by Alexandru Ardelean <ardeleanalex@gmail.com>.
+
+See these patches for reference:
+- https://github.com/openwrt/packages/pull/784
+- https://github.com/openwrt/packages/blob/master/lang/python/python/patches/006-remove-multi-arch-and-local-paths.patch
+- http://cgit.openembedded.org/openembedded-core/tree/meta/recipes-devtools/python/python/host_include_contamination.patch
+
+Signed-off-by: Bastian Stender <bst@pengutronix.de>
+---
+ setup.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/setup.py b/setup.py
+index 4ce7075150d1..29b9de4a4607 100644
+--- a/setup.py
++++ b/setup.py
+@@ -458,9 +458,9 @@ class PyBuildExt(build_ext):
+ if not cross_compiling:
+ add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
+ add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
++ self.add_multiarch_paths()
+ if cross_compiling:
+ self.add_gcc_paths()
+- self.add_multiarch_paths()
+
+ # Add paths specified in the environment variables LDFLAGS and
+ # CPPFLAGS for header and library files.
diff --git a/patches/Python-2.7.16/autogen.sh b/patches/Python-2.7.16/autogen.sh
new file mode 100755
index 000000000..903ce7847
--- /dev/null
+++ b/patches/Python-2.7.16/autogen.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+# to add config.guess and config.sub
+automake --copy --add-missing || true
+
+autoheader --force
+
+autoconf \
+ --force \
+ --warnings=cross \
+ --warnings=syntax \
+ --warnings=obsolete \
+ --warnings=unsupported
+
diff --git a/patches/Python-2.7.16/series b/patches/Python-2.7.16/series
new file mode 100644
index 000000000..476244734
--- /dev/null
+++ b/patches/Python-2.7.16/series
@@ -0,0 +1,12 @@
+# generated by git-ptx-patches
+#tag:base --start-number 1
+0001-Add-support-for-socketcan-to-the-python-socket-modul.patch
+0002-use-AC_CHECK_SIZEOF-rather-than-AC_TRY_COMPILE-for-l.patch
+0003-use-AC_TYPE_LONG_DOUBLE-to-detect-long-double-suppor.patch
+0004-setup.py-don-t-leak-host-path-into-cross-compilation.patch
+0005-add-cross-compilation-support.patch
+0006-python-don-t-add-rpaths-in-setup.py.patch
+0007-add-more-search-paths.patch
+0008-resolve-existing-LD_LIBRARY_PATH-during-make-not-dur.patch
+0009-python2-prevent-host-path-leakage.patch
+# 1fb48b2848c102e3848999b1d9f65710 - git-ptx-patches magic