-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.py
More file actions
145 lines (131 loc) · 4.47 KB
/
Copy pathbuild.py
File metadata and controls
145 lines (131 loc) · 4.47 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
"""
Build script for NeuronNotes EXE - Optimized Version
"""
import subprocess
import sys
import os
print("=" * 60)
print(" Building NeuronNotes.exe (Optimized)")
print("=" * 60)
cmd = [
sys.executable, "-m", "PyInstaller",
"--name=NeuronNotes",
"--onefile",
"--windowed",
"--clean",
"--noconfirm",
# Bundle assets INTO the EXE (critical for icon to work!)
"--add-data=app/assets/icon.ico;app/assets",
"--add-data=app/assets/icon.png;app/assets",
# UPX compression
"--upx-dir=.",
"--upx-exclude=vcruntime140.dll",
"--upx-exclude=python3*.dll",
"--upx-exclude=api-ms-*.dll",
"--upx-exclude=ucrtbase.dll",
"--upx-exclude=msvcp140.dll",
# Hidden imports
"--hidden-import=app",
"--hidden-import=app.core",
"--hidden-import=app.core.link_engine",
"--hidden-import=app.core.note_manager",
"--hidden-import=app.core.tag_engine",
"--hidden-import=app.core.constants",
"--hidden-import=app.ui",
"--hidden-import=app.ui.main_window",
"--hidden-import=app.ui.sidebar",
"--hidden-import=app.ui.editor",
"--hidden-import=app.ui.theme",
"--hidden-import=app.ui.backlinks_panel",
"--hidden-import=app.ui.tags_panel",
"--hidden-import=app.utils",
"--hidden-import=app.utils.config",
"--hidden-import=app.utils.file_handler",
"--hidden-import=PyQt6.QtWidgets",
"--hidden-import=PyQt6.QtCore",
"--hidden-import=PyQt6.QtGui",
# Exclude unused PyQt6 modules
"--exclude-module=PyQt6.QtNetwork",
"--exclude-module=PyQt6.QtWebEngineCore",
"--exclude-module=PyQt6.QtWebEngineWidgets",
"--exclude-module=PyQt6.QtWebSockets",
"--exclude-module=PyQt6.QtMultimedia",
"--exclude-module=PyQt6.QtMultimediaWidgets",
"--exclude-module=PyQt6.QtSql",
"--exclude-module=PyQt6.QtOpenGL",
"--exclude-module=PyQt6.QtOpenGLWidgets",
"--exclude-module=PyQt6.QtQml",
"--exclude-module=PyQt6.QtQuick",
"--exclude-module=PyQt6.QtQuickWidgets",
"--exclude-module=PyQt6.QtQuick3D",
"--exclude-module=PyQt6.Qt3DCore",
"--exclude-module=PyQt6.Qt3DRender",
"--exclude-module=PyQt6.Qt3DInput",
"--exclude-module=PyQt6.Qt3DLogic",
"--exclude-module=PyQt6.Qt3DAnimation",
"--exclude-module=PyQt6.Qt3DExtras",
"--exclude-module=PyQt6.QtBluetooth",
"--exclude-module=PyQt6.QtLocation",
"--exclude-module=PyQt6.QtNfc",
"--exclude-module=PyQt6.QtPositioning",
"--exclude-module=PyQt6.QtRemoteObjects",
"--exclude-module=PyQt6.QtSensors",
"--exclude-module=PyQt6.QtSerialPort",
"--exclude-module=PyQt6.QtTest",
"--exclude-module=PyQt6.QtDBus",
"--exclude-module=PyQt6.QtHelp",
"--exclude-module=PyQt6.QtDesigner",
"--exclude-module=PyQt6.QtCharts",
"--exclude-module=PyQt6.QtDataVisualization",
"--exclude-module=PyQt6.QtPdf",
"--exclude-module=PyQt6.QtPdfWidgets",
"--exclude-module=PyQt6.QtSpatialAudio",
"--exclude-module=PyQt6.QtSvg",
"--exclude-module=PyQt6.QtSvgWidgets",
"--exclude-module=PyQt6.QtTextToSpeech",
"--exclude-module=PyQt6.QtWebChannel",
"--exclude-module=PyQt6.QtXml",
# Exclude other bloat
"--exclude-module=tkinter",
"--exclude-module=tcl",
"--exclude-module=tk",
"--exclude-module=unittest",
"--exclude-module=email",
"--exclude-module=html",
"--exclude-module=http",
"--exclude-module=xml",
"--exclude-module=xmlrpc",
"--exclude-module=pydoc",
"--exclude-module=doctest",
"--exclude-module=numpy",
"--exclude-module=pandas",
"--exclude-module=matplotlib",
"--exclude-module=scipy",
"--exclude-module=PIL",
"--exclude-module=pillow",
]
# Add icon for EXE metadata (shows in File Explorer)
icon_path = os.path.join("app", "assets", "icon.ico")
if os.path.exists(icon_path):
cmd.append(f"--icon={icon_path}")
print(f"Using icon: {icon_path}")
# Check UPX
upx_path = os.path.join(".", "upx.exe")
if os.path.exists(upx_path):
print(f"UPX found: {upx_path}")
else:
print("WARNING: upx.exe not found")
cmd.append("run.py")
print("\nBuilding... this will take 3-5 minutes\n")
result = subprocess.run(cmd)
if result.returncode == 0:
exe_path = os.path.join("dist", "NeuronNotes.exe")
if os.path.exists(exe_path):
size_mb = os.path.getsize(exe_path) / (1024 * 1024)
print("\n" + "=" * 60)
print(" SUCCESS!")
print(f" Your EXE is at: {os.path.abspath(exe_path)}")
print(f" Size: {size_mb:.1f} MB")
print("=" * 60)
else:
print("\n BUILD FAILED")