summaryrefslogtreecommitdiffstats
path: root/patches/Python-2.7.16/0009-python2-prevent-host-path-leakage.patch
blob: ab5e0d42f29952751f1a34ee1721906f1e4c4afa (plain)
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
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.