Skip to content

Commit deea0c1

Browse files
committed
getpath: Update build directory assumptions based on python-cmake-buildsystem
This ensures the following tests pass: - `test_sys` (`SysModuleTest.test_stdlib_dir`) - `test_frozen` (`TestFrozen.test_unfrozen_submodule_in_frozen_package`)
1 parent ca2fd1a commit deea0c1

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Modules/getpath.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@
180180
STDLIB_SUBDIR = f'{platlibdir}/python{VERSION_MAJOR}.{VERSION_MINOR}'
181181
STDLIB_LANDMARKS = [f'{STDLIB_SUBDIR}/os.py', f'{STDLIB_SUBDIR}/os.pyc']
182182
PLATSTDLIB_LANDMARK = f'{platlibdir}/python{VERSION_MAJOR}.{VERSION_MINOR}/lib-dynload'
183-
BUILDSTDLIB_LANDMARKS = ['Lib/os.py']
183+
BUILDSTDLIB_LANDMARKS = [f'lib/python{VERSION_MAJOR}.{VERSION_MINOR}/os.py']
184184
VENV_LANDMARK = 'pyvenv.cfg'
185185
ZIP_LANDMARK = f'{platlibdir}/python{VERSION_MAJOR}{VERSION_MINOR}.zip'
186186
DELIM = ':'
@@ -510,10 +510,14 @@ def search_up(prefix, *landmarks, test=isfile):
510510
else:
511511
build_stdlib_prefix = search_up(build_prefix, *BUILDSTDLIB_LANDMARKS)
512512
# Always use the build prefix for stdlib
513+
if os_name == 'nt':
514+
lib = 'Lib'
515+
else:
516+
lib = f'lib/python{VERSION_MAJOR}.{VERSION_MINOR}'
513517
if build_stdlib_prefix:
514-
stdlib_dir = joinpath(build_stdlib_prefix, 'Lib')
518+
stdlib_dir = joinpath(build_stdlib_prefix, lib)
515519
else:
516-
stdlib_dir = joinpath(build_prefix, 'Lib')
520+
stdlib_dir = joinpath(build_prefix, lib)
517521
# Only use the build prefix for prefix if it hasn't already been set
518522
if not prefix:
519523
prefix = build_stdlib_prefix

0 commit comments

Comments
 (0)