Permalink
Browse files

Merge pull request #354 from piotr-dobrogost/activate_deactivate_refa…

…ctoring

Refactoring to show logic better
  • Loading branch information...
2 parents c75e9ef + 549bbf6 commit 57d6b24cd54c864ca448c6bb5dff7d6c137aada5 @pnasrat pnasrat committed Nov 14, 2012
Showing with 9 additions and 15 deletions.
  1. +7 −13 virtualenv_embedded/activate.bat
  2. +2 −2 virtualenv_embedded/deactivate.bat
@@ -1,32 +1,26 @@
@echo off
set "VIRTUAL_ENV=__VIRTUAL_ENV__"
-if not defined PROMPT (
- set "PROMPT=$P$G"
-)
-
if defined _OLD_VIRTUAL_PROMPT (
set "PROMPT=%_OLD_VIRTUAL_PROMPT%"
+) else (
+ if not defined PROMPT (
+ set "PROMPT=$P$G"
+ )
+ set "_OLD_VIRTUAL_PROMPT=%PROMPT%"
)
-
-if defined _OLD_VIRTUAL_PYTHONHOME (
- set "PYTHONHOME=%_OLD_VIRTUAL_PYTHONHOME%"
-)
-
-set "_OLD_VIRTUAL_PROMPT=%PROMPT%"
set "PROMPT=__VIRTUAL_WINPROMPT__ %PROMPT%"
-if defined PYTHONHOME (
+if not defined _OLD_VIRTUAL_PYTHONHOME (
set "_OLD_VIRTUAL_PYTHONHOME=%PYTHONHOME%"
- set PYTHONHOME=
)
+set PYTHONHOME=
if defined _OLD_VIRTUAL_PATH (
set "PATH=%_OLD_VIRTUAL_PATH%"
) else (
set "_OLD_VIRTUAL_PATH=%PATH%"
)
-
set "PATH=%VIRTUAL_ENV%\__BIN_NAME__;%PATH%"
:END
@@ -2,8 +2,8 @@
if defined _OLD_VIRTUAL_PROMPT (
set "PROMPT=%_OLD_VIRTUAL_PROMPT%"
+ set _OLD_VIRTUAL_PROMPT=
)
-set _OLD_VIRTUAL_PROMPT=
if defined _OLD_VIRTUAL_PYTHONHOME (
set "PYTHONHOME=%_OLD_VIRTUAL_PYTHONHOME%"
@@ -12,7 +12,7 @@ if defined _OLD_VIRTUAL_PYTHONHOME (
if defined _OLD_VIRTUAL_PATH (
set "PATH=%_OLD_VIRTUAL_PATH%"
+ set _OLD_VIRTUAL_PATH=
)
-set _OLD_VIRTUAL_PATH=
:END

0 comments on commit 57d6b24

Please sign in to comment.