-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_exe.py
More file actions
59 lines (48 loc) · 1.58 KB
/
Copy pathbuild_exe.py
File metadata and controls
59 lines (48 loc) · 1.58 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
"""
build_exe.py — Script untuk compile PUTRI menjadi .exe
Jalankan: python build_exe.py
Requirements: pip install pyinstaller
"""
import subprocess
import sys
import os
def build():
print("=" * 55)
print(" 🌸 PUTRI — Build .exe Script")
print(" Menggunakan PyInstaller")
print("=" * 55)
# Cek PyInstaller
try:
import PyInstaller
print(f"✅ PyInstaller ditemukan: {PyInstaller.__version__}")
except ImportError:
print("❌ PyInstaller belum terinstall.")
print(" Jalankan: pip install pyinstaller")
sys.exit(1)
# Command build
cmd = [
sys.executable, "-m", "PyInstaller",
"--onefile", # satu file .exe
"--windowed", # tanpa console window
"--name=PUTRI", # nama output
"--add-data=assets;assets", # sertakan folder assets (Windows: titik koma)
]
# Tambahkan ikon jika ada
if os.path.exists("assets/icon.ico"):
cmd += ["--icon=assets/icon.ico"]
cmd.append("putri.py")
print("\n🔨 Memulai build...")
print(f" Perintah: {' '.join(cmd)}\n")
result = subprocess.run(cmd, capture_output=False)
if result.returncode == 0:
print("\n" + "=" * 55)
print(" ✅ Build berhasil!")
print(" 📁 File .exe ada di folder: dist/PUTRI.exe")
print("=" * 55)
else:
print("\n" + "=" * 55)
print(" ❌ Build gagal. Cek pesan error di atas.")
print("=" * 55)
sys.exit(1)
if __name__ == "__main__":
build()