56 lines
1.5 KiB
Batchfile
56 lines
1.5 KiB
Batchfile
@echo off
|
|
setlocal enabledelayedexpansion
|
|
|
|
REM Run the app in development mode (no .exe build).
|
|
REM Useful during testing on the dev workstation.
|
|
|
|
echo === Detecting Python ===
|
|
|
|
REM Activate virtual environment if present
|
|
if exist .venv\Scripts\activate.bat (
|
|
echo Activating .venv virtual environment...
|
|
call .venv\Scripts\activate.bat
|
|
) else if exist venv\Scripts\activate.bat (
|
|
echo Activating venv virtual environment...
|
|
call venv\Scripts\activate.bat
|
|
)
|
|
|
|
REM Determine the python command to use (prefer python, fallback to py)
|
|
set PYTHON_CMD=python
|
|
where %PYTHON_CMD% >nul 2>nul
|
|
if errorlevel 1 (
|
|
set PYTHON_CMD=py
|
|
where !PYTHON_CMD! >nul 2>nul
|
|
if errorlevel 1 (
|
|
echo Python could not be found! Please ensure Python is installed and added to your system PATH.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
)
|
|
|
|
echo Using Python command: !PYTHON_CMD!
|
|
|
|
echo === Syncing dependencies ===
|
|
!PYTHON_CMD! -m pip install -r requirements.txt
|
|
if errorlevel 1 (
|
|
echo Failed to sync dependencies.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
echo === Preparing assets ===
|
|
if exist icon_small.png (
|
|
echo Generating high-quality icon.ico from icon_small.png...
|
|
!PYTHON_CMD! -c "from PIL import Image; import os; img = Image.open('icon_small.png'); img.save(os.path.join('app', 'assets', 'icon.ico'), format='ICO', sizes=[(256, 256), (128, 128), (64, 64), (48, 48), (32, 32), (16, 16)])" >nul 2>nul
|
|
)
|
|
|
|
echo === Running application in dev mode ===
|
|
!PYTHON_CMD! -m app
|
|
if errorlevel 1 (
|
|
echo Application exited with an error.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
endlocal
|