Something went wrong. Try again.
What happens if I push all of nixpkgs
Something went wrong. Try again.
nixpkgs pkgs development interpreters python cpython 3.7 fix-finding-headers-when-cross-compiling.patch
2.4 kB · 54 lines
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455From debccd4be0a8d619770f63622d9de1b451dd02ac Mon Sep 17 00:00:00 2001From: Ben Wolsieffer <benwolsieffer@gmail.com>Date: Fri, 25 Sep 2020 16:49:16 -0400Subject: [PATCH] Fix finding headers when cross compiling
When cross-compiling third-party extensions, get_python_inc() may be called toreturn the path to Python's headers. However, it uses the sys.prefix orsys.exec_prefix of the build Python, which returns incorrect paths whencross-compiling (paths pointing to build system headers).
To fix this, we use the INCLUDEPY and CONFINCLUDEPY conf variables, which canbe configured to point at host Python by setting _PYTHON_SYSCONFIGDATA_NAME.The existing behavior is maintained on non-POSIX platforms or if a prefix ismanually specified.--- Lib/distutils/sysconfig.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.pyindex 37feae5df7..6d4ad06696 100644--- a/Lib/distutils/sysconfig.py+++ b/Lib/distutils/sysconfig.py@@ -95,8 +95,6 @@ def get_python_inc(plat_specific=0, prefix=None): If 'prefix' is supplied, use it instead of sys.base_prefix or sys.base_exec_prefix -- i.e., ignore 'plat_specific'. """- if prefix is None:- prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX if os.name == "posix": if python_build: # Assume the executable is in the build directory. The@@ -109,9 +107,17 @@ def get_python_inc(plat_specific=0, prefix=None): else: incdir = os.path.join(get_config_var('srcdir'), 'Include') return os.path.normpath(incdir)- python_dir = 'python' + get_python_version() + build_flags- return os.path.join(prefix, "include", python_dir)+ if prefix is None:+ if plat_specific:+ return get_config_var('CONFINCLUDEPY')+ else:+ return get_config_var('INCLUDEPY')+ else:+ python_dir = 'python' + get_python_version() + build_flags+ return os.path.join(prefix, "include", python_dir) elif os.name == "nt":+ if prefix is None:+ prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX if python_build: # Include both the include and PC dir to ensure we can find # pyconfig.h-- 2.28.0