@echo off REM Simple backend build script (ASCII only, avoid encoding issues) cd /d "%~dp0" echo ======================================== echo Building backend_api with PyInstaller... echo ======================================== echo Checking Python environment... python -c "import PyInstaller" 2>nul if errorlevel 1 ( echo PyInstaller not found, installing... pip install --upgrade setuptools pip install pyinstaller if errorlevel 1 ( echo Failed to install PyInstaller. Please run: pip install pyinstaller pause exit /b 1 ) ) else ( echo Checking PyInstaller dependencies... python -c "import jaraco" 2>nul if errorlevel 1 ( echo Missing dependencies detected, fixing... pip install --upgrade setuptools pip install --upgrade --force-reinstall pyinstaller ) ) echo Cleaning old build/dist... if exist build ( echo Removing build directory... rmdir /s /q build 2>nul timeout /t 1 /nobreak >nul ) if exist dist ( echo Removing dist directory... rmdir /s /q dist 2>nul timeout /t 1 /nobreak >nul ) if exist backend_api.spec ( echo Removing old spec file... del /q backend_api.spec 2>nul ) echo Running PyInstaller with --clean flag... python -m PyInstaller --clean --name backend_api --console --paths .. --hidden-import wrench_controller app.py if errorlevel 1 ( echo Build failed! pause exit /b 1 ) echo. echo Build success! echo Executable: dist\backend_api\backend_api.exe echo. echo If you have an existing wrench.db, copy it to: echo dist\backend_api\wrench.db echo. echo Then run: echo dist\backend_api\backend_api.exe echo. pause