lazy_deps.py 1.2 KB

1234567891011121314151617181920212223242526
  1. """Shims to suppress old updater work until relaunch. New code must not use these."""
  2. from typing import NoReturn
  3. from hermes_cli._old_updater import in_historical_update, stop_for_relaunch
  4. def ensure(feature: str, *, prompt: bool = True) -> NoReturn:
  5. # Shim to suppress old updater work until relaunch. Do not claim readiness.
  6. # Preserve the dependency-unavailable failure without claiming a completed install.
  7. raise ImportError("Dependencies are unknown to this old updater. Please relaunch Hermes.")
  8. def install_specs(specs: list[str] | tuple[str, ...], *, timeout: int = 300,
  9. constraints: list | None = None, dry_run: bool = False) -> NoReturn:
  10. # Plugins still call this retired API during normal agent construction.
  11. # Only an actual updater call stack may transfer control to the updater;
  12. # argv can still say "serve" or "gateway" when /update runs in-process.
  13. # Historical updaters also passed constraints/dry_run; accepted and ignored.
  14. if in_historical_update():
  15. # never returns: hands off to the takeover child and exits
  16. stop_for_relaunch()
  17. raise ImportError(
  18. "tools.lazy_deps.install_specs is retired; runtime dependency "
  19. "installation is unavailable."
  20. )