Skip to content

Commit 138c7da

Browse files
committed
fix(core): Preserve native Python path integrity during context swaps
1 parent a6c775e commit 138c7da

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

omnipkg/core.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7266,7 +7266,15 @@ def switch_active_python(self, version: str) -> int:
72667266
safe_print(_(" Run 'omnipkg list python' to see managed interpreters."))
72677267
safe_print(f" If Python {version} is 'Discovered', first adopt it with: omnipkg python adopt {version}")
72687268
return 1
7269-
target_interpreter_str = str(target_interpreter_path)
7269+
if "venv-native" in str(target_interpreter_path):
7270+
# If it is, IGNORE the symlink path and get the TRUE native path.
7271+
# This is the sacred path that must be preserved.
7272+
true_native_path = str(self.config_manager.venv_path / 'bin' / f'python{version}')
7273+
target_interpreter_str = true_native_path
7274+
safe_print(f" - ✅ Detected swap to native interpreter. Using original path: {target_interpreter_str}")
7275+
else:
7276+
# For all OTHER interpreters, the managed path is correct.
7277+
target_interpreter_str = str(target_interpreter_path)
72707278
safe_print(_(' - Found managed interpreter at: {}').format(target_interpreter_str))
72717279
new_paths = self.config_manager._get_paths_for_interpreter(target_interpreter_str)
72727280
if not new_paths:

0 commit comments

Comments
 (0)