Source

virtualenvwrapper / windows / deactivate.ps1

Full commit
# This is an almost line-by-line porting to PowerShell of Ian Bicking's deactivate.bat
# script. One change is that it removes the VIRTUAL_ENV from the environment. It also
# moves the

# Restore the original prompt function, if avail, that was saved in the env var
if (test-path env:_OLD_VIRTUAL_PROMPT) {
    invoke-expression "function global:prompt { $env:_OLD_VIRTUAL_PROMPT }"
    # Get rid of our saved prompt
    Remove-Item env:_OLD_VIRTUAL_PROMPT -force 
}

# Restore the original path, if avail, that was saved in the env var
if (test-path env:_OLD_VIRTUAL_PATH) {
    $env:PATH = $env:_OLD_VIRTUAL_PATH
    # Get rid of our saved path
    Remove-Item env:_OLD_VIRTUAL_PATH -force 
}

# Remove any indication we're in a virtual env
if (test-path env:VIRTUAL_ENV) {
    Remove-Item env:VIRTUAL_ENV -force 
}


#if (test-path env:VIRTUAL_ENV) {
#    dir env:VIRTUAL_ENV
#}
#if (test-path env:_OLD_VIRTUAL_PROMPT) {
#    dir env:_OLD_VIRTUAL_PROMPT
#}
#if (test-path env:_OLD_VIRTUAL_PATH) {
#    dir env:_OLD_VIRTUAL_PATH
#}
#dir env:PATH
#(dir function:prompt).definition