aboutsummaryrefslogtreecommitdiff
path: root/app/backends/envs.py
diff options
context:
space:
mode:
authorhistoria <historiavg@proton.me>2026-08-27 17:03:57 -0400
committerhistoria <historiavg@proton.me>2026-08-27 17:03:57 -0400
commitcef2352a5e81b272d067c2c02eb9588e54edfcfd (patch)
tree83af416a82d9e854f44b6f3207eb8ea648b0896d /app/backends/envs.py
parent6527240aa69a08f06e36e796818721abeec9f592 (diff)
downloadtts-audiobook-generator-cef2352a5e81b272d067c2c02eb9588e54edfcfd.tar.gz
feat: automatic updates added to configure backend menu
Diffstat (limited to 'app/backends/envs.py')
-rw-r--r--app/backends/envs.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/app/backends/envs.py b/app/backends/envs.py
index 50154c2..ff6d1bf 100644
--- a/app/backends/envs.py
+++ b/app/backends/envs.py
@@ -190,22 +190,28 @@ def install_requirements(skip_optional: bool = False) -> int:
def pip_install(packages: List[str], *, emit=None, cancel=None,
- env_dir: Optional[Path] = None) -> int:
+ env_dir: Optional[Path] = None,
+ upgrade: bool = False) -> int:
"""pip install PACKAGES into ENV (an env dir, default the app env),
creating it first if needed.
Used by the qwen/faster setup wizards to install their TTS packages into
their dedicated backend venvs (QWEN_ENV_DIR / FASTER_ENV_DIR), never
- alongside each other or the app requirements. Returns pip's exit code.
- With EMIT given (the in-TUI task view) pip runs with ``--progress-bar
- off`` so its output is clean status lines rather than carriage-return
- progress spam.
+ alongside each other or the app requirements. With UPGRADE the install
+ runs with ``-U``: pip then resolves the latest version itself and
+ reports "Requirement already satisfied" when the env already holds it —
+ the backend update action's cheap freshness check. Returns pip's exit
+ code. With EMIT given (the in-TUI task view) pip runs with
+ ``--progress-bar off`` so its output is clean status lines rather than
+ carriage-return progress spam.
"""
if not env_exists(env_dir) and create_env(env_dir) != 0:
return 1
target = env_dir if env_dir is not None else ENV_DIR
print(f"[INFO] pip install {' '.join(packages)} into {target}...")
argv = [str(env_python(env_dir)), "-m", "pip", "install"]
+ if upgrade:
+ argv.append("-U")
if emit is not None:
argv.append("--progress-bar")
argv.append("off")