@echo off setlocal cd /d "%~dp0" set "VENV_PY=.venv\Scripts\python.exe" set "STAMP_FILE=.venv\.last-install" set "NEED_INSTALL=0" if not exist "%VENV_PY%" ( echo Creating virtual environment... py -m venv .venv if errorlevel 1 ( echo Failed to create virtual environment. exit /b 1 ) set "NEED_INSTALL=1" ) else if not exist "%STAMP_FILE%" ( set "NEED_INSTALL=1" ) else ( "%VENV_PY%" -c "import pathlib, sys, time; p=pathlib.Path(r'%STAMP_FILE%'); sys.exit(0 if time.time()-p.stat().st_mtime >= 20*3600 else 1)" if not errorlevel 1 set "NEED_INSTALL=1" ) if "%NEED_INSTALL%"=="1" ( echo Installing plugin-helper... "%VENV_PY%" -m pip install -e . if errorlevel 1 ( echo Failed to install plugin-helper. exit /b 1 ) type nul > "%STAMP_FILE%" ) "%VENV_PY%" -m plugin_helper set EXIT_CODE=%ERRORLEVEL% endlocal & exit /b %EXIT_CODE%