diff options
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. |
