diff options
author | Steve Dower <steve.dower@python.org> | 2021-12-08 19:25:58 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-08 19:25:58 (GMT) |
commit | 7778116c2f573edf320bd55301137a968e4339d8 (patch) | |
tree | dfdc3d43400f0f1f511aa0097e4d6bccfc077833 /Modules/getpath.py | |
parent | 3cb9731b7e59b0df9a7a9ab6b7746a669958b693 (diff) | |
download | cpython-7778116c2f573edf320bd55301137a968e4339d8.zip cpython-7778116c2f573edf320bd55301137a968e4339d8.tar.gz cpython-7778116c2f573edf320bd55301137a968e4339d8.tar.bz2 |
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.
Diffstat (limited to 'Modules/getpath.py')
-rw-r--r-- | Modules/getpath.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/Modules/getpath.py b/Modules/getpath.py index 6a13e23..84c9760 100644 --- a/Modules/getpath.py +++ b/Modules/getpath.py @@ -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 |