Skip to content

Commit c5b7d63

Browse files
committed
fixup! Fix test_embed
Signed-off-by: Filipe Laíns <[email protected]>
1 parent fa3adba commit c5b7d63

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

Lib/test/test_embed.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1649,7 +1649,8 @@ def test_init_pyvenv_cfg(self):
16491649
config = {
16501650
'base_prefix': sysconfig.get_config_var("prefix"),
16511651
'base_exec_prefix': exec_prefix,
1652-
'exec_prefix': exec_prefix,
1652+
'exec_prefix': tmpdir,
1653+
'prefix': tmpdir,
16531654
'base_executable': base_executable,
16541655
'executable': executable,
16551656
'module_search_paths': paths,

Modules/getpath.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -641,12 +641,9 @@ def search_up(prefix, *landmarks, test=isfile):
641641

642642
# For a venv, update the main prefix/exec_prefix but leave the base ones unchanged
643643
if venv_prefix:
644-
if not prefix:
645-
base_prefix = prefix
646-
prefix = venv_prefix
647-
if not exec_prefix:
648-
base_exec_prefix = exec_prefix
649-
exec_prefix = venv_prefix
644+
base_prefix = prefix
645+
base_exec_prefix = exec_prefix
646+
prefix = exec_prefix = venv_prefix
650647

651648

652649
# After calculating prefix and exec_prefix, use their values for base_prefix and
@@ -761,12 +758,12 @@ def search_up(prefix, *landmarks, test=isfile):
761758
# QUIRK: Non-Windows replaces prefix/exec_prefix with defaults when running
762759
# in build directory. This happens after pythonpath calculation.
763760
# Virtual environments using the build directory Python still keep their prefix.
764-
if os_name != 'nt' and build_prefix:
765-
base_prefix = config.get('base_prefix') or PREFIX
766-
base_exec_prefix = config.get('base_exec_prefix') or EXEC_PREFIX or prefix
761+
if not venv_prefix and os_name != 'nt' and build_prefix:
767762
if not venv_prefix:
768-
prefix = config.get('prefix') or base_prefix
769-
exec_prefix = config.get('exec_prefix') or base_exec_prefix
763+
prefix = config.get('prefix') or PREFIX
764+
exec_prefix = config.get('exec_prefix') or EXEC_PREFIX or prefix
765+
base_prefix = config.get('base_prefix') or prefix
766+
base_exec_prefix = config.get('base_exec_prefix') or base_prefix
770767

771768

772769
# ******************************************************************************

0 commit comments

Comments
 (0)