-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_launcher.py
More file actions
61 lines (53 loc) · 2.03 KB
/
build_launcher.py
File metadata and controls
61 lines (53 loc) · 2.03 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
"""
PyInstaller build script for BrightOS Launcher
This script builds a standalone executable launcher that:
- Downloads/updates BrightOS Python files from GitHub
- Installs dependencies
- Runs BrightOS.py
"""
import PyInstaller.__main__
import os
import sys
def build():
"""Build BrightOS Launcher executable using PyInstaller"""
# Get the directory where this script is located
script_dir = os.path.dirname(os.path.abspath(__file__))
launcher_path = os.path.join(script_dir, 'launcher.py')
icon_path = os.path.join(script_dir, 'docs', 'public', 'favicon.ico')
# Verify files exist
if not os.path.exists(launcher_path):
print(f"Error: launcher.py not found at {launcher_path}")
return 1
if not os.path.exists(icon_path):
print(f"Warning: favicon.ico not found at {icon_path}, building without icon")
icon_arg = []
else:
icon_arg = [f'--icon={icon_path}']
print(f"Using icon: {icon_path}")
# PyInstaller arguments
pyinstaller_args = [
launcher_path,
'--name=BrightOS-Launcher',
'--onefile',
'--console', # Keep console for showing installation progress
'--clean',
'--noconfirm',
] + icon_arg
print("Building BrightOS-Launcher.exe with PyInstaller...")
print(f"Arguments: {' '.join(pyinstaller_args)}")
try:
PyInstaller.__main__.run(pyinstaller_args)
print("\n Build completed successfully!")
exe_name = 'BrightOS-Launcher.exe' if sys.platform == 'win32' else 'BrightOS-Launcher'
print(f"Executable location: {os.path.join(script_dir, 'dist', exe_name)}")
print("\nThe launcher will:")
print(" 1. Download/update BrightOS Python files from GitHub")
print(" 2. Install missing dependencies")
print(" 3. Create necessary directories")
print(" 4. Run BrightOS.py")
return 0
except Exception as e:
print(f"\n Build failed: {e}")
return 1
if __name__ == "__main__":
sys.exit(build())