mirror of
https://github.com/Heretek-AI/Strata.git
synced 2026-11-07 10:05:58 -10:00
The Terminals before 0.2.1.3 (0.2.0-beta, 0.2.1, 0.2.1.1, 0.2.1.2) install a newer Control and report "updated", but their launcher has no hand-over, so the old Control keeps running. Their updater test-starts the staged Control with --version (STRATA_NO_ACQUIRE=1, no STRATA_HANDOVER, from the .s staging folder) and shows the first 120 characters of the answer when that fails. Control now answers that start with one plain sentence and exit 7, so the old updater keeps the old Control and prints the sentence instead of "updated". Every updater that can hand over sets STRATA_HANDOVER and is not touched. Release note added.
44 lines
1.7 KiB
Python
44 lines
1.7 KiB
Python
"""Strata's small, dependency-free terminal entry point.
|
|
|
|
Run ``python strata.py --help`` from a source checkout. Optional terminal UI
|
|
dependencies are imported only by ``monitor``.
|
|
"""
|
|
|
|
import importlib.util
|
|
import sys
|
|
|
|
#: What the API server (serve, bench) imports. Everything else in the CLI is standard library.
|
|
SERVER_PACKAGES = ("jinja2", "yaml", "regex", "psutil", "requests", "numpy", "PIL")
|
|
|
|
|
|
def _preflight(argv):
|
|
"""A missing package is a typed, actionable error, never an install: starting does not run pip."""
|
|
command = next((a for a in argv if not a.startswith("-")), "")
|
|
if command not in ("serve", "bench"):
|
|
return 0
|
|
missing = [m for m in SERVER_PACKAGES if importlib.util.find_spec(m) is None]
|
|
if not missing:
|
|
return 0
|
|
sys.stderr.write(
|
|
"strata: the interpreter %s is missing packages the API server needs: %s.\n"
|
|
" Starting and serving never install anything. Use the Strata terminal archive (it carries them),\n"
|
|
" or install them yourself: python -m pip install -r requirements.txt\n"
|
|
" (status, monitor, timeskip and tune plan do not need them)\n" % (sys.executable, ", ".join(missing)))
|
|
return 5
|
|
|
|
|
|
if __name__ == "__main__":
|
|
# a newer Control installed by `strata update` takes over before anything heavy is imported (stdlib only)
|
|
from strata_cli.handover import maybe_hand_over, refuse_old_updater
|
|
refused = refuse_old_updater(sys.argv[1:])
|
|
if refused is not None:
|
|
raise SystemExit(refused)
|
|
handed = maybe_hand_over(sys.argv[1:])
|
|
if handed is not None:
|
|
raise SystemExit(handed)
|
|
code = _preflight(sys.argv[1:])
|
|
if code:
|
|
raise SystemExit(code)
|
|
from strata_cli.cli import main
|
|
raise SystemExit(main())
|