-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.py
44 lines (37 loc) · 1.15 KB
/
build.py
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
import color
import platform
import subprocess
def build():
os_type = platform.system()
if os_type == 'Windows':
command = [
"pyinstaller",
"--onefile",
"--name", "Comparer",
"--icon", "static/icon.ico",
"--add-data", "templates;templates",
"--add-data", "static;static",
"--add-data", "color.py;.",
"main.py"
]
elif os_type == 'Linux':
command = [
"pyinstaller",
"--onefile",
"--name", "Comparer",
"--add-data=templates:templates",
"--add-data=static:static",
"--add-data=color.py:.",
"main.py"
]
else:
print(color.red(f'× Unsupported OS: {os_type}'))
return
try:
subprocess.run(command)
print(color.green('✓ Build successful for platform:'), color.yellow(os_type))
except subprocess.CalledProcessError as err:
print(color.red('× Build failed for platform:'), color.yellow(os_type))
print(color.red('× Error:'), err)
if __name__ == '__main__':
build()