-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_exe.py
More file actions
75 lines (67 loc) · 2.44 KB
/
build_exe.py
File metadata and controls
75 lines (67 loc) · 2.44 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
"""
Script per creare l'eseguibile con error handling
"""
import PyInstaller.__main__
import os
import shutil
# Pulizia file vecchi
print("🧹 Pulizia file di build precedenti...")
if os.path.exists('build'):
shutil.rmtree('build')
print(" ✓ Rimossa cartella build/")
if os.path.exists('dist'):
shutil.rmtree('dist')
print(" ✓ Rimossa cartella dist/")
if os.path.exists('iOS-ShareEasy.spec'):
os.remove('iOS-ShareEasy.spec')
print(" ✓ Rimosso file .spec")
# Verifica che l'icona .ico esista (PyInstaller richiede .ico, non .png)
icon_path = os.path.join('icons', 'icon.ico')
icon_path_absolute = os.path.abspath(icon_path)
if os.path.exists(icon_path):
print(f"✓ Icona trovata: {icon_path_absolute}")
else:
print(f"⚠ Icona non trovata: {icon_path}")
print("\n🔨 Avvio build...")
# Configurazione per PyInstaller con main_safe.py
args = [
'main.py',
'--name=iOS-ShareEasy',
'--onefile',
'--windowed',
f'--icon={icon_path_absolute}' if os.path.exists(icon_path) else '--icon=NONE',
f'--add-data={os.path.abspath("icons")}{os.pathsep}icons', # Include la cartella icons
'--noupx',
'--hidden-import=win32timezone',
'--hidden-import=uvicorn.logging',
'--hidden-import=uvicorn.loops',
'--hidden-import=uvicorn.loops.auto',
'--hidden-import=uvicorn.protocols',
'--hidden-import=uvicorn.protocols.http',
'--hidden-import=uvicorn.protocols.http.auto',
'--hidden-import=uvicorn.protocols.websockets',
'--hidden-import=uvicorn.protocols.websockets.auto',
'--hidden-import=uvicorn.lifespan',
'--hidden-import=uvicorn.lifespan.on',
'--hidden-import=PyQt6.QtCore',
'--hidden-import=PyQt6.QtGui',
'--hidden-import=PyQt6.QtWidgets',
'--collect-all=PyQt6',
'--collect-all=uvicorn',
]
PyInstaller.__main__.run(args)
# Pulizia post-build
print("\n🧹 Pulizia post-build...")
if os.path.exists('build'):
shutil.rmtree('build')
print(" ✓ Rimossa cartella build/")
if os.path.exists('iOS-ShareEasy.spec'):
os.remove('iOS-ShareEasy.spec')
print(" ✓ Rimosso file .spec")
print("\n✅ Build completata!")
print("📦 Eseguibile creato in: dist/iOS-ShareEasy.exe")
print("📝 I log saranno salvati nella cartella: logs/")
print("\n💡 Caratteristiche:")
print(" • Icona personalizzata nella taskbar e system tray")
print(" • Solo un'istanza può essere eseguita alla volta")
print(" • Log salvati in logs/ nella cartella del programma")