distribution/packages/lang/Python3/patches/Python3-0202-xcompile.patch

48 lines
2.2 KiB
Diff
Raw Normal View History

--- a/setup.py
+++ b/setup.py
@@ -742,31 +742,23 @@ class PyBuildExt(build_ext):
2022-02-05 14:23:32 +00:00
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')
+ try:
+ modules_include_dirs = os.environ["PYTHON_MODULES_INCLUDE"].split()
+ except KeyError:
+ modules_include_dirs = ['/usr/include']
+ try:
+ modules_lib_dirs = os.environ["PYTHON_MODULES_LIB"].split()
+ except KeyError:
+ modules_lib_dirs = ['/usr/lib']
self.add_multiarch_paths()
- # only change this for cross builds for 3.3, issues on Mageia
- if CROSS_COMPILING:
- self.add_cross_compiling_paths()
+ for dir in modules_include_dirs:
+ add_dir_to_list(self.compiler.include_dirs, dir)
+ for dir in modules_lib_dirs:
+ add_dir_to_list(self.compiler.library_dirs, dir)
+
self.add_ldflags_cppflags()
def init_inc_lib_dirs(self):
- if (not CROSS_COMPILING and
- os.path.normpath(sys.base_prefix) != '/usr' and
- not sysconfig.get_config_var('PYTHONFRAMEWORK')):
- # OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework
- # (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"))
- add_dir_to_list(self.compiler.include_dirs,
- sysconfig.get_config_var("INCLUDEDIR"))
-
system_lib_dirs = ['/lib64', '/usr/lib64', '/lib', '/usr/lib']
system_include_dirs = ['/usr/include']
# lib_dirs and inc_dirs are used to search for files;