aboutsummaryrefslogtreecommitdiff
path: root/app/backends/envs.py
diff options
context:
space:
mode:
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")