-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_binary.py
More file actions
35 lines (30 loc) · 883 Bytes
/
build_binary.py
File metadata and controls
35 lines (30 loc) · 883 Bytes
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
import os
import subprocess
import sys
def build():
print("Building Sutra CLI standalone binary...")
# Check if pyinstaller is installed
try:
import PyInstaller
except ImportError:
print("Error: PyInstaller is not installed. Run: pip install pyinstaller")
sys.exit(1)
# Command to build the binary
# --onefile: Create a single executable
# --name: Name of the output binary
# --entrypoint: The script to run
cmd = [
"pyinstaller",
"--onefile",
"--name", "sutra",
"--clean",
"sutra_cli/main.py"
]
try:
subprocess.run(cmd, check=True)
print("\nBuild successful! The binary is located in the 'dist' folder.")
except subprocess.CalledProcessError as e:
print(f"\nBuild failed: {e}")
sys.exit(1)
if __name__ == "__main__":
build()