diff options
| author | historia <historiavg@proton.me> | 2026-08-25 18:10:08 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-08-25 18:10:08 -0400 |
| commit | 4b49797b4d57c2d2cf63472636622a7a6280a38e (patch) | |
| tree | e3687c734de5d6159cdad288e025057ed6cd3a16 /app/backends/faster.py | |
| parent | bcac6c42eaf9e004716d72960bddefb1db68a93c (diff) | |
| download | tts-audiobook-generator-4b49797b4d57c2d2cf63472636622a7a6280a38e.tar.gz | |
feat: no console drop when uninstalling backends
Diffstat (limited to 'app/backends/faster.py')
| -rwxr-xr-x | app/backends/faster.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/app/backends/faster.py b/app/backends/faster.py index 585e480..8c64183 100755 --- a/app/backends/faster.py +++ b/app/backends/faster.py @@ -591,21 +591,32 @@ def _detect_remote(managed: bool = False): return False, {} -def uninstall() -> int: +def uninstall(*, emit=None, cancel=None) -> int: """Remove the faster-qwen3-tts backend entirely. Uninstalls the pip package (``faster-qwen3-tts``) from the managed venv and deletes the cloned checkout (``app/faster-qwen3-tts``, which holds examples/openai_server.py and voices.json). A running server this tool - started is stopped first (best-effort). Returns the exit code. + started is stopped first (best-effort). + + With EMIT given (the in-TUI task view) pip runs piped, streaming into + EMIT, so its output never touches the terminal behind curses. CANCEL is + a ``threading.Event`` honored between phases only (stop server / pip / + delete checkout) — a started phase always completes, so pip is never + killed mid-run. Returns the exit code (130 when cancelled before a + remaining phase). """ servers.stop("faster") - rc = common.pip_uninstall(["faster-qwen3-tts"]) + if common.cancel_requested(cancel): + return 130 + rc = common.pip_uninstall(["faster-qwen3-tts"], emit=emit) if rc != 0: print("[WARNING] pip uninstall failed (exit " f"{rc}); remove faster-qwen3-tts from the managed venv manually") else: print("[OK] faster-qwen3-tts removed.") + if common.cancel_requested(cancel): + return 130 checkout = _checkout() if checkout.is_dir(): print(f"[INFO] Removing checkout {checkout}...") |
