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.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/backends/envs.py b/app/backends/envs.py
index 6e5b6cc..5a51a33 100644
--- a/app/backends/envs.py
+++ b/app/backends/envs.py
@@ -107,6 +107,20 @@ def pip_install(packages: List[str]) -> int:
[str(env_python()), "-m", "pip", "install", *packages])
+def pip_uninstall(packages: List[str]) -> int:
+ """pip uninstall PACKAGES from the venv. Returns pip's exit code.
+
+ Used by the backends' ``uninstall`` action to remove pip-installed TTS
+ packages from the managed environment. A missing env is a no-op (there
+ is nothing to uninstall from), reported as success.
+ """
+ if not env_exists():
+ return 0
+ print(f"[INFO] pip uninstall {' '.join(packages)} from {ENV_DIR}...")
+ return common.run_console_subprocess(
+ [str(env_python()), "-m", "pip", "uninstall", "-y", *packages])
+
+
def module_available(module: str) -> bool:
"""True when MODULE imports inside the venv (e.g. qwen_tts, faster_qwen3_tts).