Skip to content

Commit

Permalink
Merge pull request #220 from zooba/issue-219
Browse files Browse the repository at this point in the history
#219 Use sysconfig.get_config_h_filename() to locate pyconfig.h
  • Loading branch information
jaraco authored Feb 12, 2024
2 parents ee021a1 + fbe8abe commit 6da7ebb
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions distutils/sysconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -361,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():
Expand Down

0 comments on commit 6da7ebb

Please sign in to comment.