45 lines
1.1 KiB
Python
Executable File
45 lines
1.1 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Run a deterministic Local Voice installation preflight."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parent.parent
|
|
RENDERER = ROOT / "scripts" / "local_voice.py"
|
|
|
|
|
|
def main() -> int:
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("--runtime-root")
|
|
parser.add_argument("--device", choices=("metal", "cpu", "cuda"), default="metal")
|
|
args = parser.parse_args()
|
|
command = [
|
|
sys.executable,
|
|
str(RENDERER),
|
|
"doctor",
|
|
"--device",
|
|
args.device,
|
|
]
|
|
if args.runtime_root:
|
|
command.extend(["--runtime-root", args.runtime_root])
|
|
completed = subprocess.run(command, check=False)
|
|
if completed.returncode:
|
|
return completed.returncode
|
|
completed = subprocess.run(
|
|
[sys.executable, str(RENDERER), "list"],
|
|
check=False,
|
|
)
|
|
if completed.returncode:
|
|
return completed.returncode
|
|
print("Local Voice installation preflight passed.")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|