-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathstartup.bat
74 lines (53 loc) · 1.83 KB
/
startup.bat
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
@ECHO OFF
:: Check for Python Installation
py -3.10 > NUL
if errorlevel 1 (goto errorNoPylauncher) else (goto pyLauncherScript)
:pyLauncherScript
:: Reaching here means Python is installed.
echo "Upgrading pip..."
py -3.10 -m pip install --upgrade pip > NUL
if errorlevel 1 goto errorPipUpgrade
py -3.10 -m pip install --upgrade setuptools > NUL
if errorlevel 1 goto errorSetuptoolsUpgrade
echo "Creating virtual environment..."
py -3.10 -m pip install virtualenv
py -3.10 -m venv venv
.\venv\Scripts\activate.bat
echo "Installing requirements..."
pip install -r requirements.txt > NUL
if errorlevel 1 goto errorRequirements
python main.py
:pythonScript
echo "Upgrading pip..."
python -m pip install --upgrade pip > NUL
if errorlevel 1 goto errorPipUpgrade
python -m pip install --upgrade setuptools > NUL
if errorlevel 1 goto errorSetuptoolsUpgrade
echo "Creating virtual environment..."
python -m pip install virtualenv
python -m venv venv
.\venv\Scripts\activate.bat
echo "Installing requirements..."
pip install -r requirements.txt > NUL
if errorlevel 1 goto errorRequirements
python main.py
:: Execute stuff...
:: Once done, exit the batch file -- skips executing the errorNoPython section
goto:eof
:errorNoPylauncher
python --version | findstr 3.10 > NUL
if errorlevel 1 (goto errorNoPython) else (goto pythonScript)
:errorNoPython
echo "Python 3.10 is not installed."
echo "Please install Python 3.10 and try again."
echo "Exiting..."
exit 1
:errorPipUpgrade
echo.
echo Error^: pip upgrade failed
:errorSetuptoolsUpgrade
echo.
echo Error^: setuptools upgrade failed
:errorRequirements
echo.
echo Error^: requirements installation failed