bpo-46015: Fixes calculation of sys.path in a venv on Windows (GH-29992)

Also ensures that pybuilddir.txt is written early enough in the build to be picked up by later steps.
This commit is contained in:
Steve Dower 2021-12-08 19:25:58 +00:00 committed by GitHub
parent 3cb9731b7e
commit 7778116c2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 20 additions and 12 deletions

View file

@ -668,14 +668,17 @@ elif not pythonpath:
pythonpath.append(joinpath(prefix, p))
# Then add stdlib_dir and platstdlib_dir
if stdlib_dir:
pythonpath.append(stdlib_dir)
if platstdlib_dir:
if os_name == 'nt' and venv_prefix:
# QUIRK: Windows appends executable_dir instead of platstdlib_dir
# when in a venv
pythonpath.append(executable_dir)
else:
if os_name == 'nt' and venv_prefix:
# QUIRK: Windows generates paths differently in a venv
if platstdlib_dir:
pythonpath.append(platstdlib_dir)
if stdlib_dir:
pythonpath.append(stdlib_dir)
pythonpath.append(executable_dir)
else:
if stdlib_dir:
pythonpath.append(stdlib_dir)
if platstdlib_dir:
pythonpath.append(platstdlib_dir)
config['module_search_paths'] = pythonpath