From 93d1bc59313732c0a9a0f109554b613dbe360578 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Tue, 12 Dec 2023 00:13:38 +0000 Subject: [PATCH 1/2] Fixes #219 Use sysconfig.get_config_h_filename() to locate pyconfig.h --- distutils/sysconfig.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/distutils/sysconfig.py b/distutils/sysconfig.py index a40a7231..c89fff4b 100644 --- a/distutils/sysconfig.py +++ b/distutils/sysconfig.py @@ -195,12 +195,11 @@ def _get_python_inc_posix_prefix(prefix): def _get_python_inc_nt(prefix, spec_prefix, plat_specific): if python_build: - # Include both the include and PC dir to ensure we can find - # pyconfig.h + # Include both include dirs to ensure we can find pyconfig.h return ( os.path.join(prefix, "include") + os.path.pathsep - + os.path.join(prefix, "PC") + + os.path.dirname(sysconfig.get_config_h_filename()) ) return os.path.join(prefix, "include") From f24fc228ee1066e34c661e40ebe8402f1a7e6f3d Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Mon, 18 Dec 2023 17:46:10 +0000 Subject: [PATCH 2/2] Also use sysconfig.get_config_h_filename() to implement distutils.sysconfig version --- distutils/sysconfig.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/distutils/sysconfig.py b/distutils/sysconfig.py index c89fff4b..fac3259f 100644 --- a/distutils/sysconfig.py +++ b/distutils/sysconfig.py @@ -360,14 +360,7 @@ def customize_compiler(compiler): # noqa: C901 def get_config_h_filename(): """Return full pathname of installed pyconfig.h file.""" - if python_build: - if os.name == "nt": - inc_dir = os.path.join(_sys_home or project_base, "PC") - else: - inc_dir = _sys_home or project_base - return os.path.join(inc_dir, 'pyconfig.h') - else: - return sysconfig.get_config_h_filename() + return sysconfig.get_config_h_filename() def get_makefile_filename():