-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_script.py
More file actions
39 lines (33 loc) · 1.28 KB
/
build_script.py
File metadata and controls
39 lines (33 loc) · 1.28 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
import PyInstaller.__main__
import os
import platform
# Get the current directory
current_dir = os.path.dirname(os.path.abspath(__file__))
# Determine the operating system
os_type = platform.system()
# Define the icon based on the operating system
if os_type == "Darwin": # macOS
icon = "Comma.icns"
elif os_type == "Linux": # Linux
icon = "Comma.png"
else: # Windows or others
icon = "Comma.ico"
# Define the output and working directories
dist_path = os.path.join(current_dir, "dist", os_type)
work_path = os.path.join(current_dir, "build", os_type)
# Ensure the output and working directories exist
os.makedirs(dist_path, exist_ok=True)
os.makedirs(work_path, exist_ok=True)
PyInstaller.__main__.run([
'note.py', # your main script
'--name=Comma', # name of your executable
'--windowed', # prevents console window from appearing
'--onefile', # creates a single executable file
f'--icon={icon}', # path to your icon file (optional)
'--add-data=README.md:.', # add any additional files needed
'--clean', # clean PyInstaller cache
'--noconfirm', # replace output directory without asking
f'--distpath={dist_path}', # output directory
f'--workpath={work_path}', # working directory
# '--splash=splash.png' # optional splash screen
])