Repository navigation
Expand file tree
/
Copy pathbuild.bat
More file actions
144 lines (130 loc) · 5.28 KB
/
Copy pathbuild.bat
File metadata and controls
144 lines (130 loc) · 5.28 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
@echo off
setlocal
:: ╔══════════════════════════════════════════════════════════════════════════╗
:: ║ PHOENIX PROTOCOL — One-Click Build Script ║
:: ║ ║
:: ║ Usage: Double-click build.bat (or run in cmd from project root) ║
:: ║ Output: Phoenix-Setup.exe (send this to every enterprise user) ║
:: ╚══════════════════════════════════════════════════════════════════════════╝
title Phoenix Protocol — Build
echo.
echo ============================================================
echo PHOENIX PROTOCOL — BUILD PIPELINE
echo ============================================================
echo.
if not exist Phoenix.spec (
echo [ERROR] Phoenix.spec is missing.
pause
exit /b 1
)
if not exist requirements.txt (
echo [ERROR] requirements.txt is missing.
pause
exit /b 1
)
:: ── Check Python ─────────────────────────────────────────────────────────
py -3 --version >nul 2>&1
if %errorlevel% neq 0 (
python --version >nul 2>&1
if %errorlevel% neq 0 (
echo [ERROR] Python not found. Install Python 3 first.
pause
exit /b 1
)
set "PY_CMD=python"
) else (
set "PY_CMD=py -3"
)
%PY_CMD% --version >nul 2>&1
if %errorlevel% neq 0 (
echo [ERROR] Could not resolve a working Python command.
pause
exit /b 1
)
echo [OK] Python found: %PY_CMD%
:: ── Install / upgrade all dependencies ───────────────────────────────────
echo.
echo [STEP 1/4] Installing Python dependencies...
echo ─────────────────────────────────────────────
%PY_CMD% -m pip install --upgrade pip --quiet
if %errorlevel% neq 0 (
echo [ERROR] Failed to upgrade pip.
pause
exit /b 1
)
%PY_CMD% -m pip install -r requirements.txt --quiet
if %errorlevel% neq 0 (
echo [ERROR] Failed to install requirements.txt.
pause
exit /b 1
)
echo [OK] All dependencies installed
:: ── Clean previous build ──────────────────────────────────────────────────
echo.
echo [STEP 2/4] Cleaning previous build artifacts...
echo ─────────────────────────────────────────────
if exist dist rmdir /s /q dist
if exist build rmdir /s /q build
echo [OK] Clean
:: ── PyInstaller — compile to single .exe ─────────────────────────────────
echo.
echo [STEP 3/4] Compiling Phoenix.exe with PyInstaller...
echo ─────────────────────────────────────────────
echo (This takes 2-5 minutes the first time)
echo.
%PY_CMD% -m PyInstaller Phoenix.spec --noconfirm --clean
if %errorlevel% neq 0 (
echo.
echo [ERROR] PyInstaller failed. Check output above.
pause
exit /b 1
)
if not exist dist\Phoenix.exe (
echo.
echo [ERROR] Build reported success but dist\Phoenix.exe was not created.
pause
exit /b 1
)
echo.
echo [OK] Phoenix.exe compiled: dist\Phoenix.exe
:: Check NSIS is installed
echo.
echo [STEP 4/4] Packaging installer with NSIS...
echo ─────────────────────────────────────────────
where makensis >nul 2>&1
if %errorlevel% neq 0 (
echo [SKIP] NSIS not found — skipping installer packaging.
echo.
echo To create Phoenix-Setup.exe:
echo 1. Download NSIS from: https://nsis.sourceforge.io/Download
echo 2. Install NSIS
echo 3. Re-run build.bat
echo.
echo ─────────────────────────────────────────────────────────────
echo BUILD COMPLETE (no installer)
echo Distributable: dist\Phoenix.exe
echo ─────────────────────────────────────────────────────────────
echo.
pause
exit /b 0
)
makensis installer.nsi
if %errorlevel% neq 0 (
echo [ERROR] NSIS packaging failed.
pause
exit /b 1
)
if not exist Phoenix-Setup.exe (
echo [ERROR] NSIS reported success but Phoenix-Setup.exe was not created.
pause
exit /b 1
)
echo.
echo ============================================================
echo BUILD COMPLETE
echo Distributable installer: Phoenix-Setup.exe
echo Share this one file with every user in your organisation.
echo ============================================================
echo.
pause
endlocal