-
Notifications
You must be signed in to change notification settings - Fork 1
/
start.bat
108 lines (96 loc) · 2.57 KB
/
start.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
@echo off
setlocal enabledelayedexpansion
set VENV_DIR=WIN_venv
set VENV_REQUIREMENTS=configs/requirements/venv_requirements.txt
set PROJECT_REQUIREMENTS=configs/requirements/requirements.txt
echo Debug: Script started
goto main
:check_and_create_venv
if not exist %VENV_DIR% (
echo Creating virtual environment...
python -m venv %VENV_DIR%
)
echo Debug: Pass Check and Create
goto :eof
:activate_venv
if exist %VENV_DIR%\Scripts\activate.bat (
call %VENV_DIR%\Scripts\activate.bat
) else (
echo Error: 'venv' not present. Please run 'start.bat install'.
exit /b 1
)
goto :eof
:deactivate_venv
if exist %VENV_DIR%\Scripts\deactivate.bat (
call %VENV_DIR%\Scripts\deactivate.bat
)
goto :eof
:install_venv
echo Debug: Starting install_venv
echo.
echo Installing requirements for virtual environment...
pip install -r %VENV_REQUIREMENTS%
call :check_and_create_venv
call :activate_venv
echo +++++++++++++++++++++++++++++++++++++++++++++
echo.
echo Installing requirements for project environment...
pip install -r %PROJECT_REQUIREMENTS%
call :deactivate_venv
echo Installation complete.
echo +++++++++++++++++++++++++++++++++++++++++++++
pause
goto :eof
:start_project
echo +++++++++++++++++++++++++++++++++++++++++++++
echo Debug: Starting project
call :activate_venv
echo Starting the Project...
python run.py
if %errorlevel% neq 0 (
echo ERROR: Could not start script 'run.py'...
)
call :deactivate_venv
echo Deactivating ENV
echo +++++++++++++++++++++++++++++++++++++++++++++
goto :eof
:display_menu
echo Debug: Displaying menu
echo Please choose an option:
echo 1) Start
echo 2) First Install
echo 3) Exit
set /p option=Option:
if "%option%"=="1" (
call :start_project
) else if "%option%"=="2" (
call :install_venv
call :start_project
) else if "%option%"=="3" (
echo +++++++++++++++++++++++++++++++++++++++++++++
echo We are going to be shut down guys!
echo Say ya'll prayers Your wives miss ya
exit /b 0
) else (
echo +++++++++++++++++++++++++++++++++++++++++++++
echo Invalid option selected. Exiting...
exit /b 1
)
goto :eof
:main
echo Debug: Checking arguments
if "%1"=="" (
call :display_menu
) else if "%1"=="start" (
call :start_project
) else if "%1"=="install" (
call :install_venv
call :start_project
) else (
echo +++++++++++++++++++++++++++++++++++++++++++++
echo Nah man, this is XMENU, not some bullshit %1!
echo It's 'start' 'install' or nothing Got it?!
exit /b 1
)
goto :eof
goto :main