From 9079e77d4ca8fedc62c2040f691dfd2e7205217d Mon Sep 17 00:00:00 2001 From: rnhmjoj Date: Sun, 21 Aug 2022 16:18:20 +0200 Subject: [PATCH 1/2] Fix, again, finding headers during cross compiling --- distutils/sysconfig.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/distutils/sysconfig.py b/distutils/sysconfig.py index aae9c1b3..4b722043 100644 --- a/distutils/sysconfig.py +++ b/distutils/sysconfig.py @@ -165,9 +165,8 @@ def _get_python_inc_from_config(plat_specific, spec_prefix): platform Python installation, while the current Python executable is from the build platform installation. """ - if not spec_prefix: - return - return get_config_var('CONF' * plat_specific + 'INCLUDEPY') + if spec_prefix is None: + return get_config_var('CONF' * plat_specific + 'INCLUDEPY') def _get_python_inc_posix_prefix(prefix): From 5152a55c9fdbb76f5bfc9035521d7d7ad2054166 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 21 Aug 2022 15:41:03 -0400 Subject: [PATCH 2/2] Add unit tests capturing the expectation --- distutils/sysconfig.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/distutils/sysconfig.py b/distutils/sysconfig.py index 4b722043..3dd8185f 100644 --- a/distutils/sysconfig.py +++ b/distutils/sysconfig.py @@ -164,6 +164,16 @@ def _get_python_inc_from_config(plat_specific, spec_prefix): the host platform Python installation, while the current Python executable is from the build platform installation. + + >>> monkeypatch = getfixture('monkeypatch') + >>> gpifc = _get_python_inc_from_config + >>> monkeypatch.setitem(gpifc.__globals__, 'get_config_var', str.lower) + >>> gpifc(False, '/usr/bin/') + >>> gpifc(False, '') + >>> gpifc(False, None) + 'includepy' + >>> gpifc(True, None) + 'confincludepy' """ if spec_prefix is None: return get_config_var('CONF' * plat_specific + 'INCLUDEPY')