`_ensure_uv_path` accepted `$HERMES_HOME/bin/uv[.exe]` on is_file()+X_OK alone, so a dead relocated launcher a pre-fix installer had salvaged there was handed to `hermes update` and doctor/repair forever; the only self-heal lived in install.ps1. Probe it with `uv --version` (exit code, OSError = dead) and fall through to the existing `_install_uv` when it fails. Invariant test: an executable exit-1 stand-in is replaced (red before: `_install_uv` called 0 times; green after). The Windows plain-str test answers the probe for its shell-script `uv.exe` stand-in.
52 lines
1.6 KiB
Python
52 lines
1.6 KiB
Python
"""Shims to stop the old updater doing work until relaunch.
|
|
|
|
An updater already in memory imports these names after replacing its checkout.
|
|
They must not install anything, delegate to PM, or return a falsy value that
|
|
would send that old process down its pip fallback. New code must not use them.
|
|
"""
|
|
|
|
from pathlib import Path
|
|
from typing import NoReturn
|
|
|
|
from hermes_cli._old_updater import stop_for_relaunch
|
|
|
|
|
|
def _reload_hermes_constants() -> NoReturn:
|
|
# Shim to suppress old updater work until relaunch. Callers dereference the
|
|
# result, so None crashes. Stop without re-executing live globals.
|
|
stop_for_relaunch()
|
|
|
|
|
|
def ensure_uv(*args, **kwargs) -> NoReturn:
|
|
# Shim to stop the old updater doing work until relaunch. Older releases
|
|
# expect a tuple, newer ones a path. Exit before either can consume it.
|
|
stop_for_relaunch()
|
|
|
|
|
|
def update_managed_uv(*args, **kwargs) -> NoReturn:
|
|
# Shim to stop the old updater doing work until relaunch.
|
|
stop_for_relaunch()
|
|
|
|
|
|
def resolve_uv(*args, **kwargs) -> NoReturn:
|
|
# Shim to stop the old updater doing work until relaunch, not enable pip.
|
|
stop_for_relaunch()
|
|
|
|
|
|
def managed_python_env(
|
|
project_root: Path | None = None,
|
|
*,
|
|
install_dir: Path | None = None,
|
|
base_env: dict[str, str] | None = None,
|
|
**kwargs,
|
|
) -> NoReturn:
|
|
# Shim to stop the old updater doing work until relaunch, not prepare a child.
|
|
stop_for_relaunch()
|
|
|
|
|
|
def rebuild_venv(
|
|
uv_bin: str, venv_dir: Path, python_version: str = "3.11", **kwargs
|
|
) -> NoReturn:
|
|
# Shim to stop the old updater doing work until relaunch, not claim a rebuild.
|
|
stop_for_relaunch()
|