-
Notifications
You must be signed in to change notification settings - Fork 14
/
boot_django_for_runners.cmd
114 lines (94 loc) · 2.31 KB
/
boot_django_for_runners.cmd
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
109
110
111
112
113
114
@echo off
REM ~ Windows Batch file to boot Django-ForRunners
REM ~
REM ~ It's create a virtualenv under "C:\Program Files\Django-ForRunners"
REM ~
REM ~ Start Django-ForRunners by double-click on:
REM ~
REM ~ "C:\Program Files\Django-ForRunners\Scripts\for_runners.exe"
title %~0
cd /d "%~dp0"
for /f "delims=;" %%i in ('py -V') do set VERSION=%%i
for /f "delims=;" %%i in ('py -3 -V') do set VERSION3=%%i
cls
echo.
if "%VERSION%"=="" (
echo Sorry, Python 'py' launcher seems not to exist:
echo.
echo on
py -V
@echo off
echo.
echo Please install Python!
echo.
pause
exit
)
echo Python 'py' launcher exists, default version is: %VERSION%
if "%VERSION3%"=="" (
echo.
echo Python v3 not installed!
echo Sorry, Django-ForRunners doesn't run with Python v2 :(
echo.
pause
exit
) else (
echo Python v3 is: %VERSION%
)
whoami /groups | find "S-1-16-12288" > nul
if errorlevel 1 (
echo.
echo Error: You must start this batchfile with admin rights!
echo.
pause
exit /b
)
set BASE_PATH=%ProgramFiles%\Django-ForRunners
echo on
mkdir "%BASE_PATH%"
@echo off
call:test_exist "%BASE_PATH%" "venv not found here:"
echo on
py -3 -m venv "%BASE_PATH%"
@echo off
set SCRIPT_PATH=%BASE_PATH%\Scripts
call:test_exist "%SCRIPT_PATH%" "venv/Script path not found here:"
set ACTIVATE=%SCRIPT_PATH%\activate.bat
call:test_exist "%ACTIVATE%" "venv activate not found here:"
echo on
call "%ACTIVATE%"
set PYTHON_EXE=%SCRIPT_PATH%\python.exe
call:test_exist "%PYTHON_EXE%" "Python not found here:"
echo on
"%PYTHON_EXE%" -m pip install --upgrade pip
@echo off
set PIP_EXE=%SCRIPT_PATH%\pip.exe
call:test_exist "%PIP_EXE%" "pip not found here:"
echo on
"%PIP_EXE%" install -e git+https://github.com/jedie/django-for-runners.git@master#egg=django-for-runners
@echo off
set REQ_TXT=%BASE_PATH%/src/django-for-runners/requirements.txt
call:test_exist "%REQ_TXT%" "Requirements not found here:"
echo on
"%PIP_EXE%" install -r "%REQ_TXT%"
@echo off
set EXE=%SCRIPT_PATH%/for_runners.exe
call:test_exist "%EXE%" "for_runners.exe not found here:"
echo on
"%EXE%" --version
echo on
explorer.exe %BASE_PATH%
@echo off
pause
exit 0
:test_exist
if NOT exist "%~1" (
echo.
echo ERROR: %~2
echo.
echo "%~1"
echo.
pause
exit 1
)
goto:eof