-
Notifications
You must be signed in to change notification settings - Fork 15
/
launch.bat
34 lines (25 loc) · 822 Bytes
/
launch.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
@echo off
set PYTHON=python
set VENV_DIR=.venv
:start_venv
if [%VENV_DIR%] == [-] goto :skip_venv
dir %VENV_DIR%\Scripts\Python.exe
if %ERRORLEVEL% == 0 goto :activate_venv
for /f "delims=" %%i in ('CALL %PYTHON% -c "import sys; print(sys.executable)"') do set PYTHON_FULLNAME="%%i"
echo Creating venv in directory %VENV_DIR% using python %PYTHON_FULLNAME%
%PYTHON_FULLNAME% -m venv %VENV_DIR%
if %ERRORLEVEL% == 0 goto :activate_venv
echo Unable to create venv in directory %VENV_DIR%
:activate_venv
set PYTHON="%~dp0%VENV_DIR%\Scripts\python.exe"
echo venv %PYTHON%
goto :launch
:skip_venv
:launch
call %VENV_DIR%\Scripts\activate.bat
%PYTHON% -m pip install -r requirements.txt | findstr /V /C:"Requirement already satisfied"
%PYTHON% MagicPrompt.py
exit
:endofscript
echo.
echo Launch unsuccessful. Exiting.