-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsetup.bat
More file actions
71 lines (61 loc) · 1.22 KB
/
setup.bat
File metadata and controls
71 lines (61 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
@echo off
setlocal
cd /d "%~dp0"
set "VENV_PY=.venv\Scripts\python.exe"
set "REQ_FILE=requirements.txt"
if not exist "%REQ_FILE%" (
echo [ERROR] Missing %REQ_FILE%.
pause
exit /b 1
)
if exist "%VENV_PY%" goto install
echo [INFO] Creating virtual environment in .venv ...
call :find_python
if errorlevel 1 (
echo [ERROR] Python 3 not found. Please install Python 3.12+, then rerun setup.bat.
pause
exit /b 1
)
call %PYTHON_CMD% -m venv .venv
if errorlevel 1 (
echo [ERROR] Failed to create virtual environment.
pause
exit /b 1
)
:install
echo [INFO] Installing dependencies ...
"%VENV_PY%" -m pip install --upgrade pip
if errorlevel 1 (
echo [ERROR] Failed to upgrade pip.
pause
exit /b 1
)
"%VENV_PY%" -m pip install -r "%REQ_FILE%"
if errorlevel 1 (
echo [ERROR] Failed to install dependencies.
pause
exit /b 1
)
echo.
echo [OK] Setup completed.
echo [TIP] Double-click start.bat to launch the app.
pause
exit /b 0
:find_python
set "PYTHON_CMD="
py -3.12 -V >nul 2>nul
if not errorlevel 1 (
set "PYTHON_CMD=py -3.12"
exit /b 0
)
py -3 -V >nul 2>nul
if not errorlevel 1 (
set "PYTHON_CMD=py -3"
exit /b 0
)
python -V >nul 2>nul
if not errorlevel 1 (
set "PYTHON_CMD=python"
exit /b 0
)
exit /b 1