forked from davidmarble/virtualenvwrapper-win
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmkvirtualenv.bat
More file actions
51 lines (39 loc) · 840 Bytes
/
mkvirtualenv.bat
File metadata and controls
51 lines (39 loc) · 840 Bytes
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
@echo off
if [%1]==[] goto USAGE
goto MKVIRTUALENV
:USAGE
echo.
echo Pass a name to create a new virtualenv
echo.
goto END
:MKVIRTUALENV
if not defined WORKON_HOME (
set WORKON_HOME=%USERPROFILE%\Envs
)
call :GET_ENVNAME %*
SETLOCAL EnableDelayedExpansion
pushd "%WORKON_HOME%" 2>NUL && popd
@if errorlevel 1 (
mkdir "%WORKON_HOME%"
)
pushd "%WORKON_HOME%\%ENVNAME%" 2>NUL && popd
@if not errorlevel 1 (
echo.
echo virtualenv "%ENVNAME" already exists
echo.
goto end
)
pushd "%WORKON_HOME%"
virtualenv.exe %*
popd
REM Add unsetting of VIRTUAL_ENV to deactivate.bat
echo set VIRTUAL_ENV=>>"%WORKON_HOME%\%ENVNAME%\Scripts\deactivate.bat"
ENDLOCAL & "%WORKON_HOME%\%ENVNAME%\Scripts\activate.bat"
echo.
goto END
:GET_ENVNAME
set "ENVNAME=%~1"
shift
if not "%~1"=="" goto GET_ENVNAME
goto :eof
:END