38 lines
1009 B
Python
38 lines
1009 B
Python
|
|
#!/usr/bin/env python3
|
||
|
|
"""Build the voice confirmation desktop client with PyInstaller (run on target OS)."""
|
||
|
|
|
||
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
import argparse
|
||
|
|
import shutil
|
||
|
|
import subprocess
|
||
|
|
import sys
|
||
|
|
from pathlib import Path
|
||
|
|
|
||
|
|
|
||
|
|
def main() -> None:
|
||
|
|
root = Path(__file__).resolve().parents[1]
|
||
|
|
spec = root / "voice_client.spec"
|
||
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
||
|
|
parser.add_argument(
|
||
|
|
"--clean",
|
||
|
|
action="store_true",
|
||
|
|
help="Remove build/ and dist/ before building",
|
||
|
|
)
|
||
|
|
args = parser.parse_args()
|
||
|
|
if args.clean:
|
||
|
|
for name in ("build", "dist"):
|
||
|
|
p = root / name
|
||
|
|
if p.is_dir():
|
||
|
|
shutil.rmtree(p)
|
||
|
|
if not spec.is_file():
|
||
|
|
print(f"Missing {spec}", file=sys.stderr)
|
||
|
|
sys.exit(1)
|
||
|
|
cmd = [sys.executable, "-m", "PyInstaller", str(spec), "--noconfirm"]
|
||
|
|
print("Running:", " ".join(cmd))
|
||
|
|
raise SystemExit(subprocess.call(cmd, cwd=root))
|
||
|
|
|
||
|
|
|
||
|
|
if __name__ == "__main__":
|
||
|
|
main()
|