@echo off
setlocal EnableExtensions EnableDelayedExpansion
cd /d "%~dp0"
set "PYTHONIOENCODING=utf-8"
set "PYTHONPATH=%~dp0vendor;%~dp0src;%PYTHONPATH%"

if exist ".venv\Scripts\python.exe" (
  ".venv\Scripts\python.exe" "run_daily_update.py" %*
  exit /b !errorlevel!
)

where py >nul 2>&1
if not errorlevel 1 (
  py -3.12 "run_daily_update.py" %*
  exit /b !errorlevel!
)

where python >nul 2>&1
if not errorlevel 1 (
  python "run_daily_update.py" %*
  exit /b !errorlevel!
)

echo [ERROR] Python 3.12 was not found. 1>&2
exit /b 9009
