Files
Inv_web/build_client_agent_v2_installer_windows.bat
2026-07-09 15:54:31 +03:00

63 lines
1.9 KiB
Batchfile

@echo off
setlocal
cd /d "%~dp0"
set "SPEC_FILE=client_agent_v2_windows_onefile.spec"
set "CLIENT_EXE=dist\Inv_web Client.exe"
set "INSTALLER_SCRIPT=client_agent_v2_installer.iss"
set "ISCC=%ProgramFiles(x86)%\Inno Setup 6\ISCC.exe"
if not exist "%SPEC_FILE%" (
echo Spec file not found: %SPEC_FILE%
exit /b 1
)
if not exist "%INSTALLER_SCRIPT%" (
echo Installer script not found: %INSTALLER_SCRIPT%
exit /b 1
)
if not exist "%ISCC%" set "ISCC=%ProgramFiles%\Inno Setup 6\ISCC.exe"
if not exist "%ISCC%" set "ISCC=%LocalAppData%\Programs\Inno Setup 6\ISCC.exe"
if not exist "%ISCC%" for /f "delims=" %%I in ('where ISCC.exe 2^>nul') do set "ISCC=%%I"
if not exist "%ISCC%" (
where winget >nul 2>nul
if not errorlevel 1 (
echo Inno Setup 6 was not found. Installing it with winget...
winget install --id JRSoftware.InnoSetup -e --silent --accept-package-agreements --accept-source-agreements
)
)
if not exist "%ISCC%" set "ISCC=%ProgramFiles(x86)%\Inno Setup 6\ISCC.exe"
if not exist "%ISCC%" set "ISCC=%ProgramFiles%\Inno Setup 6\ISCC.exe"
if not exist "%ISCC%" set "ISCC=%LocalAppData%\Programs\Inno Setup 6\ISCC.exe"
if not exist "%ISCC%" for /f "delims=" %%I in ('where ISCC.exe 2^>nul') do set "ISCC=%%I"
if not exist "%ISCC%" (
echo.
echo ERROR: Inno Setup 6 is not installed.
echo Install it from: https://jrsoftware.org/isdl.php
echo Then run this BAT file again.
exit /b 1
)
echo Inno Setup compiler: %ISCC%
echo Installing Python build dependencies...
py -m pip install --upgrade pyinstaller pystray pillow
if errorlevel 1 exit /b 1
echo Building client executable...
py -m PyInstaller --clean --noconfirm "%SPEC_FILE%"
if errorlevel 1 exit /b 1
if not exist "%CLIENT_EXE%" (
echo Client executable was not created: %CLIENT_EXE%
exit /b 1
)
echo Building Windows installer...
"%ISCC%" "%INSTALLER_SCRIPT%"
if errorlevel 1 exit /b 1
echo.
echo Done: %~dp0dist\Inv_web_Client_Setup.exe
exit /b 0