-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.py
More file actions
50 lines (42 loc) · 1.51 KB
/
build.py
File metadata and controls
50 lines (42 loc) · 1.51 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
import subprocess
import os
import sys
def run_command(command):
print(f"Running: {command}")
try:
subprocess.check_call(command, shell=True)
print("Success.")
except subprocess.CalledProcessError as e:
print(f"Error building: {e}")
sys.exit(1)
def build():
# Ensure config.json exists
if not os.path.exists("config.json"):
print("Error: config.json not found. Please ensure it exists before building.")
return
print("Building Executables...")
# Platform specific separator
sep = ";" if os.name == 'nt' else ":"
# 1. Build Whisper Service (Windowed/Silent application)
# The user requested this to be invisible/silent.
print("\n--- Building Whisper Service ---")
whisper_cmd = (
f'pyinstaller --noconfirm --onefile --windowed --name whisper '
f'--hidden-import=speech_recognition --hidden-import=pyaudio --hidden-import=requests '
f'--add-data "config.json{sep}." '
f'whisper.py'
)
run_command(whisper_cmd)
# 2. Build GUI (Windowed application)
print("\n--- Building GUI ---")
gui_cmd = (
f'pyinstaller --noconfirm --onefile --windowed --name GUI '
f'--hidden-import=tkinter --hidden-import=speech_recognition --hidden-import=requests '
f'--add-data "config.json{sep}." '
f'GUI.py'
)
run_command(gui_cmd)
print("\nBuild Complete!")
print(f"Executables are located in: {os.path.abspath('dist')}")
if __name__ == "__main__":
build()