diff options
| author | historia <historiavg@proton.me> | 2026-08-24 01:57:13 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-08-24 01:58:17 -0400 |
| commit | c02d66b2d3221c0c5f5e8f2cb2ae218f1e325a0a (patch) | |
| tree | e9ec4f35c18102d4624d3cd59358d192be7bbfcb /audiobook.py | |
| parent | 194c63e4d11e6de9792a736a7b99788f1db78741 (diff) | |
| download | tts-audiobook-generator-c02d66b2d3221c0c5f5e8f2cb2ae218f1e325a0a.tar.gz | |
feat: manage venv for all backends
Diffstat (limited to 'audiobook.py')
| -rwxr-xr-x | audiobook.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/audiobook.py b/audiobook.py index 174d8b4..792b274 100755 --- a/audiobook.py +++ b/audiobook.py @@ -20,6 +20,13 @@ if sys.platform == "win32": except AttributeError: pass +# The managed-environment bootstrap (backends.envs) is stdlib-only and is +# imported here so main() can launch it before any third-party dependency is +# touched. It must NOT run at import time (importing this module must stay +# light so the TUI hub and the tests can import it from any environment); it +# runs only when audiobook.py is executed as a script, from main() below. +from backends import envs as _envs # noqa: I001 + from converter import config from converter.converter import ( AUDIO_FORMATS, @@ -100,6 +107,10 @@ def convert(backend: str = None, voice: str = None, clone: str = None, def main() -> None: """Entry point: TUI hub with no args in a terminal, else argparse CLI.""" + # Run inside the managed venv (envs/tts), creating it (and installing + # requirements.txt) first if needed. A no-op when already there. Done + # here rather than at import time so importing this module is light. + _envs.bootstrap(__file__) # No arguments + interactive terminal -> the TUI hub (set up backends # and process the input directory end-to-end). Anything else is the # scriptable argparse CLI. |
