gh-86179: Implement realpath() on Windows for getpath.py calculations (GH-113033)

This commit is contained in:
Steve Dower 2023-12-13 23:41:43 +00:00 • committed by GitHub
parent 41c18aacc7
commit fddc829236
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 63 additions and 11 deletions

View file

@ -404,16 +404,7 @@ def get_config_h_filename():
"""Return the path of pyconfig.h."""
if _PYTHON_BUILD:
if os.name == "nt":
# This ought to be as simple as dirname(sys._base_executable), but
# if a venv uses symlinks to a build in the source tree, then this
# fails. So instead we guess the subdirectory name from sys.winver
if sys.winver.endswith('-32'):
arch = 'win32'
elif sys.winver.endswith('-arm64'):
arch = 'arm64'
else:
arch = 'amd64'
inc_dir = os.path.join(_PROJECT_BASE, 'PCbuild', arch)
inc_dir = os.path.dirname(sys._base_executable)
else:
inc_dir = _PROJECT_BASE
else: