fix(update): isolate pip install from third-party UV env vars

uv respects UV_PYTHON_INSTALL_DIR from the process environment. When a
third-party app (e.g. WorkBuddy) sets a User-level UV_PYTHON_INSTALL_DIR,
the update's uv pip install can target the wrong interpreter and fail
installing extras, leaving the venv entry-point shims missing. Use the
official managed_python_env() isolation (drops VIRTUAL_ENV/PYTHONPATH/
UV_PYTHON, forces UV_PYTHON_INSTALL_DIR to .hermes-runtime/python,
UV_NO_CONFIG=1) and then point VIRTUAL_ENV at this install's venv.
This commit is contained in:
suntech-wang
2026-08-11 21:35:18 +08:00
committed by Teknium
parent eebe01790d
commit 08f5a0a98b
+5 -1
View File
@@ -6638,7 +6638,11 @@ def _cmd_update_impl(args, gateway_mode: bool):
install_group = "all"
if uv_bin:
uv_env = {**os.environ, "VIRTUAL_ENV": str(_m().PROJECT_ROOT / "venv")}
# 2026-08-11 patch: use official managed_python_env() isolation so
# third-party UV_PYTHON_INSTALL_DIR (WorkBuddy) cannot hijack uv;
# then point VIRTUAL_ENV at this install's venv.
uv_env = managed_python_env()
uv_env["VIRTUAL_ENV"] = str(_m().PROJECT_ROOT / "venv")
if _m()._is_termux_env(uv_env):
uv_env.pop("PYTHONPATH", None)
uv_env.pop("PYTHONHOME", None)