-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_python_env.bat
More file actions
43 lines (34 loc) · 1.18 KB
/
setup_python_env.bat
File metadata and controls
43 lines (34 loc) · 1.18 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
@echo off
rem This batch file is intended as a helper script to setup a local developer
rem build environment on windows.
rem It creates a virtual environment, activates the enviroment and installs
rem the requirements in it.
rem If it fails, the virtual env will be deactivated.
if not exist "build" mkdir build
echo Create virtual python environment
echo Create virtual python environment %time% >> build\setup.log
python -m venv build/venv
if %ERRORLEVEL% NEQ 0 (GOTO ScriptsError)
echo Activate virtual environment and install dependencies
echo Activate virtual environment and install dependencies %time% >> build\setup.log
CALL build\venv\Scripts\activate.bat
if %ERRORLEVEL% NEQ 0 (GOTO ScriptsError)
python -m pip install -r requirements.txt
if %ERRORLEVEL% NEQ 0 (GOTO ScriptsError)
rem no error occured, jump to END
goto :END
:ScriptsError
(
echo off
rem COLOR 0C
echo.
echo ***************************************************
echo * ERROR: %ERRORLEVEL%
echo * Generating files failed *
echo ***************************************************
echo.
SET LAST_ERROR=%ERRORLEVEL%
CALL build\venv\Scripts\deactivate.bat
exit /B %LAST_ERROR%
)
:END