Skip to content

Commit c6b638b

Browse files
committed
Fix test_embed
Signed-off-by: Filipe Laíns <[email protected]>
1 parent 9cc5c44 commit c6b638b

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

Modules/getpath.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -641,9 +641,12 @@ 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-
base_prefix = prefix
645-
base_exec_prefix = exec_prefix
646-
prefix = exec_prefix = 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
647650

648651

649652
# After calculating prefix and exec_prefix, use their values for base_prefix and
@@ -758,9 +761,12 @@ def search_up(prefix, *landmarks, test=isfile):
758761
# QUIRK: Non-Windows replaces prefix/exec_prefix with defaults when running
759762
# in build directory. This happens after pythonpath calculation.
760763
# Virtual environments using the build directory Python still keep their prefix.
761-
if not venv_prefix and os_name != 'nt' and build_prefix:
762-
prefix = config.get('prefix') or PREFIX
763-
exec_prefix = config.get('exec_prefix') or EXEC_PREFIX or 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
767+
if not venv_prefix:
768+
prefix = config.get('prefix') or base_prefix
769+
exec_prefix = config.get('exec_prefix') or base_exec_prefix
764770

765771

766772
# ******************************************************************************

0 commit comments

Comments
 (0)