@echo off
set VENV_DIR=%~dp0\.venv

echo Activating virtual environment %VENV_DIR%
call "%VENV_DIR%\scripts\activate"

echo Saving current directory
pushd %~dp0

echo Creating app build directory
set BUILD_DIR=appbuild
mkdir %BUILD_DIR%
cd %BUILD_DIR%

echo Creating executable
rem pyinstaller --clean --onefile ..\SwitchTester.py > build.log 2>&1
pyinstaller --noconfirm --log-level=WARN ..\SwitchTester.spec > build.log 2>&1

echo Restoring current directory
popd

echo Deactivating virtual environment
call deactivate
