Skip to content

Commit

Permalink
Add missed realpath and simplify sysconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
zooba committed Dec 13, 2023
1 parent 01bd133 commit d579fa0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
11 changes: 1 addition & 10 deletions Lib/sysconfig/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 7 additions & 1 deletion Modules/getpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,13 @@ def search_up(prefix, *landmarks, test=isfile):
# ******************************************************************************

if not base_executable:
base_executable = executable or real_executable or ''
if executable:
try:
base_executable = realpath(executable)
except OSError:
base_executable = executable
else:
base_executable = real_executable or ''

if not real_executable:
real_executable = base_executable
Expand Down

0 comments on commit d579fa0

Please sign in to comment.