-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.bat
More file actions
81 lines (70 loc) · 2.29 KB
/
setup.bat
File metadata and controls
81 lines (70 loc) · 2.29 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
72
73
74
75
76
77
78
79
80
81
@echo off
setlocal ENABLEDELAYEDEXPANSION
:: -------------------------------
:: CONFIGURATION
:: -------------------------------
set "VENV_DIR=.\pyeyesweb_env"
set "LIB_SOURCE=."
:: -------------------------------
:: -------------------------------
:: ANSI COLOR CODES (PowerShell + cmd.exe)
:: -------------------------------
set "RED=[91m"
set "GREEN=[92m"
set "YELLOW=[93m"
set "RESET=[0m"
:: -------------------------------
:: CHECK PYTHON
:: -------------------------------
echo %YELLOW%[INFO] Checking Python installation...%RESET%
where.exe python >nul 2>nul
if errorlevel 1 (
echo %RED%[ERROR] Python not found. Please install Python 3.11.%RESET%
goto :end_script
)
for /f "tokens=2 delims= " %%v in ('python --version 2^>^&1') do set "PY_VER=%%v"
echo %YELLOW%[INFO] Python version detected: %PY_VER%%RESET%
echo %PY_VER% | findstr /R "^3\.11\." >nul
if errorlevel 1 (
echo %RED%[ERROR] Python 3.11.x is required. Found %PY_VER%%RESET%
goto :end_script
)
echo %GREEN%[OK] Python 3.11.x found.%RESET%
:: -------------------------------
:: CREATE VIRTUAL ENV
:: -------------------------------
echo %YELLOW%[INFO] Creating virtual environment "%VENV_DIR%"...%RESET%
python -m venv "%VENV_DIR%"
if errorlevel 1 (
echo %RED%[ERROR] Failed to create virtual environment.%RESET%
goto :end_script
)
echo %GREEN%[OK] Virtual environment created.%RESET%
:: -------------------------------
:: ACTIVATE VENV
:: -------------------------------
echo %YELLOW%[INFO] Activating virtual environment...%RESET%
call "%VENV_DIR%\Scripts\activate.bat"
if errorlevel 1 (
echo %RED%[ERROR] Failed to activate virtual environment.%RESET%
goto :end_script
)
echo %GREEN%[OK] Virtual environment activated.%RESET%
:: -------------------------------
:: INSTALL LIBRARY
:: -------------------------------
echo %YELLOW%[INFO] Upgrading pip, setuptools, wheel...%RESET%
python -m pip install --upgrade pip setuptools wheel
echo %YELLOW%[INFO] Installing pyeyesweb from "%LIB_SOURCE%"...%RESET%
python -m pip install -U pyeyesweb
if errorlevel 1 (
echo %RED%[ERROR] Library installation failed.%RESET%
goto :end_script
)
echo %GREEN%[OK] Library installed successfully in virtual environment.%RESET%
:end_script
echo.
echo %YELLOW%[INFO] Script finished. Press any key to exit...%RESET%
pause >nul
endlocal
exit /b 0