python3: Fix multiarch/local paths added when building host Python
authorJeffery To <jeffery.to@gmail.com>
Tue, 23 May 2023 09:49:43 +0000 (17:49 +0800)
committerRosen Penev <rosenp@gmail.com>
Wed, 24 May 2023 03:04:33 +0000 (06:04 +0300)
By default, the Python build process will add /usr/local/{lib,include},
and multiarch paths (e.g. /usr/{lib,include}/x86_64-linux-gnu) if
building on Debian/Ubuntu, to its library and includes paths.

006-remove-multi-arch-and-local-paths.patch was added in
84202f17e1aac6faf66b8d186f7c5c62b6f72ffb to stop the Python build
process from adding these paths.

006-remove-multi-arch-and-local-paths.patch was removed in
48277ec9158151763239461c6f60808e38a99c2f.

006-do-not-add-multiarch-paths-when-cross-compiling.patch was added in
0c8b0b0bf727a57b0138a1425d2f32786dddd146 to stop the Python build
process from adding these paths for target Python.

These paths are still added by the Python build process when building
host Python.

This replaces the cross-compiling-only patch with the original patch,
renamed slightly and adapted for Python 3.10.

Fixes: 48277ec91581 ("python3: bump to version 3.8")
Signed-off-by: Jeffery To <jeffery.to@gmail.com>
lang/python/python3/Makefile
lang/python/python3/patches/006-do-not-add-multiarch-local-paths.patch [new file with mode: 0644]
lang/python/python3/patches/006-do-not-add-multiarch-paths-when-cross-compiling.patch [deleted file]

index eb2c4c8b26d0091df716881a8b9b70fcc231e0ea..e27457051d9549a5a81dcd258fd03d1a9d141d3f 100644 (file)
@@ -11,7 +11,7 @@ include $(TOPDIR)/rules.mk
 include ../python3-version.mk
 
 PKG_NAME:=python3
-PKG_RELEASE:=7
+PKG_RELEASE:=8
 PKG_VERSION:=$(PYTHON3_VERSION).$(PYTHON3_VERSION_MICRO)
 
 PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz
diff --git a/lang/python/python3/patches/006-do-not-add-multiarch-local-paths.patch b/lang/python/python3/patches/006-do-not-add-multiarch-local-paths.patch
new file mode 100644 (file)
index 0000000..333370e
--- /dev/null
@@ -0,0 +1,19 @@
+--- a/setup.py
++++ b/setup.py
+@@ -822,16 +822,9 @@ class PyBuildExt(build_ext):
+                         add_dir_to_list(dir_list, directory)
+     def configure_compiler(self):
+-        # Ensure that /usr/local is always used, but the local build
+-        # directories (i.e. '.' and 'Include') must be first.  See issue
+-        # 10520.
+-        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')
+         # only change this for cross builds for 3.3, issues on Mageia
+         if CROSS_COMPILING:
+             self.add_cross_compiling_paths()
+-        self.add_multiarch_paths()
+         self.add_ldflags_cppflags()
+     def init_inc_lib_dirs(self):
diff --git a/lang/python/python3/patches/006-do-not-add-multiarch-paths-when-cross-compiling.patch b/lang/python/python3/patches/006-do-not-add-multiarch-paths-when-cross-compiling.patch
deleted file mode 100644 (file)
index a2bb0fb..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/setup.py
-+++ b/setup.py
-@@ -831,7 +831,8 @@ class PyBuildExt(build_ext):
-         # only change this for cross builds for 3.3, issues on Mageia
-         if CROSS_COMPILING:
-             self.add_cross_compiling_paths()
--        self.add_multiarch_paths()
-+        else:
-+            self.add_multiarch_paths()
-         self.add_ldflags_cppflags()
-     def init_inc_lib_dirs(self):