-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompiler.bat
More file actions
161 lines (144 loc) · 3.36 KB
/
compiler.bat
File metadata and controls
161 lines (144 loc) · 3.36 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
@echo off
echo ========================================
echo Weather v1.0.0 - Build System
echo ========================================
echo.
REM Check Python
where python >nul 2>nul
if %errorlevel% neq 0 (
echo ERROR: Python not found!
pause
exit /b 1
)
REM Check PyInstaller
python -c "import PyInstaller" >nul 2>nul
if %errorlevel% neq 0 (
echo ERROR: PyInstaller not installed!
echo Install with: pip install pyinstaller
pause
exit /b 1
)
REM Menu
echo Wat wil je bouwen?
echo.
echo 1. ONEDIR
echo 2. Installer
echo 3. Alles (1+2) - AANBEVOLEN voor distributie
echo 4. Clean build folders
echo.
set /p choice="Keuze (1-4): "
if "%choice%"=="1" (
call :build_onedir
goto end
)
if "%choice%"=="2" (
call :build_installer
goto end
)
if "%choice%"=="3" (
call :build_all
goto end
)
if "%choice%"=="4" (
call :clean
goto end
)
goto end
:build_onedir
echo.
echo [1/2] Bouwen ONEDIR versie...
echo ========================================
pyinstaller --clean weather.spec
if %errorlevel% equ 0 (
echo [OK] ONEDIR gebouwd in: dist\weather\
echo.
echo Structuur:
dir /b dist\weather | more
echo.
echo Test met: dist\weather\weather.exe
) else (
echo [FAIL] ONEDIR build failed!
exit /b 1
)
REM Maak ZIP voor distributie
echo.
echo Wil je een ZIP maken voor distributie? (y/n)
set /p zip_choice=
if /i "%zip_choice%"=="y" (
echo.
echo [2/2] ZIP maken...
powershell -Command "Compress-Archive -Path 'dist\Weather' -DestinationPath 'dist\Weather.zip' -Force"
if exist dist\Weather.zip (
echo [OK] ZIP aangemaakt: dist\Weather.zip
dir dist\Weather.zip | findstr "Weather"
)
)
exit /b 0
:build_installer
echo.
echo Bouwen installer...
echo ========================================
pyinstaller --clean weather_installer.spec
if %errorlevel% equ 0 (
echo [OK] Weather_Installer.exe gebouwd!
if exist dist\Weather_Installer.exe dir dist\Weather_Installer.exe | findstr Weather_Installer
) else (
echo [FAIL] Installer build failed!
exit /b 1
)
exit /b 0
:build_all
call :build_onedir
if %errorlevel% neq 0 (
echo Build stopped due to ONEDIR failure
exit /b 1
)
call :build_installer
if %errorlevel% neq 0 (
echo Build stopped due to installer failure
exit /b 1
)
goto summary
:clean
echo.
echo Cleaning build folders...
if exist build rmdir /s /q build
if exist dist rmdir /s /q dist
if exist __pycache__ rmdir /s /q __pycache__
echo [OK] Clean completed
exit /b 0
:summary
echo.
echo ========================================
echo BUILD SUMMARY
echo ========================================
if exist dist\Weather\Weather.exe (
echo [OK] ONEDIR - dist\Weather\Weather.exe
echo Startup: ⚡ INSTANT (0.3-0.5s)
) else (
echo [ ] ONEDIR - not built
)
if exist dist\Weather.zip (
echo [OK] ONEDIR ZIP - dist\Weather.zip
dir dist\Weather.zip | findstr "Weather"
) else (
echo [ ] ONEDIR ZIP - not created
)
if exist dist\Weather_Installer.exe (
echo [OK] Installer - dist\Weather_Installer.exe
dir dist\Weather_Installer.exe | findstr "Weather_Installer"
) else (
echo [ ] Installer - not built
)
echo ========================================
echo.
echo.
echo Voor GitHub release upload:
echo 1. dist\Weather.zip (Voor handmatige installatie)
echo 2. dist\Weather_Installer.exe (Auto-installer)
echo.
exit /b 0
:end
echo.
echo Done!
pause