| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- @echo off
- setlocal enabledelayedexpansion
- cd /d "%~dp0.."
- echo ==========================================
- echo DZXJ DTU - build Windows portable exe
- echo ==========================================
- where python >nul 2>nul
- if errorlevel 1 (
- echo [ERROR] python not found in PATH. Install Python 3.10+ first.
- exit /b 1
- )
- echo [1/4] check frontend\dist ...
- if not exist "frontend\dist\index.html" (
- echo frontend\dist missing, building ...
- pushd frontend
- call npm install
- if errorlevel 1 (popd & exit /b 1)
- call npm run build
- if errorlevel 1 (popd & exit /b 1)
- popd
- )
- echo [2/4] prepare venv .venv-exe and install deps ...
- if not exist ".venv-exe\Scripts\python.exe" python -m venv .venv-exe
- call ".venv-exe\Scripts\activate.bat"
- python -m pip install --upgrade pip
- python -m pip install -r packaging\requirements_windows.txt
- if errorlevel 1 exit /b 1
- echo [3/4] pyinstaller onefile build ...
- python -m PyInstaller --noconfirm --clean --distpath dist --workpath build\pyinstaller packaging\dzxj_dtu.spec
- if errorlevel 1 exit /b 1
- echo [4/4] done
- echo output: %CD%\dist\dzxj_dtu.exe
- dir /b dist\dzxj_dtu.exe
- exit /b 0
|