-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_cli.py
More file actions
70 lines (59 loc) · 1.88 KB
/
Copy pathbuild_cli.py
File metadata and controls
70 lines (59 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env python3
"""
Build script for creating standalone Wu CLI executable.
This script builds a standalone executable using PyInstaller that
can be distributed without requiring Python installation.
Usage:
python build_cli.py
"""
import subprocess
import sys
import os
from pathlib import Path
def main():
"""Build the standalone executable."""
print("Building Wu CLI executable...")
print("=" * 60)
# Check if PyInstaller is installed
try:
import PyInstaller
print(f"PyInstaller version: {PyInstaller.__version__}")
except ImportError:
print("ERROR: PyInstaller is not installed!")
print("Install with: pip install pyinstaller")
sys.exit(1)
# Check if spec file exists
spec_file = Path("wu.spec")
if not spec_file.exists():
print(f"ERROR: {spec_file} not found!")
sys.exit(1)
# Build the executable
print(f"\nBuilding with spec file: {spec_file}")
print("-" * 60)
cmd = [
sys.executable,
"-m", "PyInstaller",
"--clean",
"--noconfirm",
str(spec_file)
]
print(f"Running: {' '.join(cmd)}")
result = subprocess.run(cmd)
if result.returncode == 0:
exe_path = Path("dist") / "wu.exe"
if exe_path.exists():
size_mb = exe_path.stat().st_size / (1024 * 1024)
print("\n" + "=" * 60)
print("[SUCCESS] Build successful!")
print(f" Executable: {exe_path}")
print(f" Size: {size_mb:.1f} MB")
print("\nYou can now distribute wu.exe as a standalone CLI tool.")
print("Test it with: dist\\wu.exe --help")
else:
print("\nWARNING: Build completed but executable not found!")
sys.exit(1)
else:
print("\nERROR: Build failed!")
sys.exit(1)
if __name__ == "__main__":
main()