michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: # This file must be used with "source bin/activate" *from bash* michael@0: # you cannot run it directly michael@0: michael@0: deactivate () { michael@0: if [ -n "$_OLD_VIRTUAL_PATH" ] ; then michael@0: PATH="$_OLD_VIRTUAL_PATH" michael@0: export PATH michael@0: unset _OLD_VIRTUAL_PATH michael@0: fi michael@0: michael@0: # This should detect bash and zsh, which have a hash command that must michael@0: # be called to get it to forget past commands. Without forgetting michael@0: # past commands the $PATH changes we made may not be respected michael@0: if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then michael@0: hash -r michael@0: fi michael@0: michael@0: if [ -n "$_OLD_VIRTUAL_PS1" ] ; then michael@0: PS1="$_OLD_VIRTUAL_PS1" michael@0: export PS1 michael@0: unset _OLD_VIRTUAL_PS1 michael@0: fi michael@0: michael@0: PYTHONPATH="$_OLD_PYTHONPATH" michael@0: export PYTHONPATH michael@0: unset _OLD_PYTHONPATH michael@0: michael@0: unset CUDDLEFISH_ROOT michael@0: michael@0: unset VIRTUAL_ENV michael@0: if [ ! "$1" = "nondestructive" ] ; then michael@0: # Self destruct! michael@0: unset deactivate michael@0: fi michael@0: } michael@0: michael@0: # unset irrelavent variables michael@0: deactivate nondestructive michael@0: michael@0: _OLD_PYTHONPATH="$PYTHONPATH" michael@0: _OLD_VIRTUAL_PATH="$PATH" michael@0: michael@0: VIRTUAL_ENV="`pwd`" michael@0: michael@0: if [ "x$OSTYPE" = "xmsys" ] ; then michael@0: CUDDLEFISH_ROOT="`pwd -W | sed s,/,\\\\\\\\,g`" michael@0: PATH="`pwd`/bin:$PATH" michael@0: # msys will convert any env vars with PATH in it to use msys michael@0: # form and will unconvert before launching michael@0: PYTHONPATH="`pwd -W`/python-lib;$PYTHONPATH" michael@0: else michael@0: CUDDLEFISH_ROOT="$VIRTUAL_ENV" michael@0: PYTHONPATH="$VIRTUAL_ENV/python-lib:$PYTHONPATH" michael@0: PATH="$VIRTUAL_ENV/bin:$PATH" michael@0: fi michael@0: michael@0: VIRTUAL_ENV="`pwd`" michael@0: michael@0: export CUDDLEFISH_ROOT michael@0: export PYTHONPATH michael@0: export PATH michael@0: michael@0: _OLD_VIRTUAL_PS1="$PS1" michael@0: if [ "`basename \"$VIRTUAL_ENV\"`" = "__" ] ; then michael@0: # special case for Aspen magic directories michael@0: # see http://www.zetadev.com/software/aspen/ michael@0: PS1="[`basename \`dirname \"$VIRTUAL_ENV\"\``] $PS1" michael@0: else michael@0: PS1="(`basename \"$VIRTUAL_ENV\"`)$PS1" michael@0: fi michael@0: export PS1 michael@0: michael@0: # This should detect bash and zsh, which have a hash command that must michael@0: # be called to get it to forget past commands. Without forgetting michael@0: # past commands the $PATH changes we made may not be respected michael@0: if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then michael@0: hash -r michael@0: fi michael@0: michael@0: python -c "from jetpack_sdk_env import welcome; welcome()"