Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 # This file must be used with "source bin/activate" *from bash*
6 # you cannot run it directly
8 deactivate () {
9 if [ -n "$_OLD_VIRTUAL_PATH" ] ; then
10 PATH="$_OLD_VIRTUAL_PATH"
11 export PATH
12 unset _OLD_VIRTUAL_PATH
13 fi
15 # This should detect bash and zsh, which have a hash command that must
16 # be called to get it to forget past commands. Without forgetting
17 # past commands the $PATH changes we made may not be respected
18 if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then
19 hash -r
20 fi
22 if [ -n "$_OLD_VIRTUAL_PS1" ] ; then
23 PS1="$_OLD_VIRTUAL_PS1"
24 export PS1
25 unset _OLD_VIRTUAL_PS1
26 fi
28 PYTHONPATH="$_OLD_PYTHONPATH"
29 export PYTHONPATH
30 unset _OLD_PYTHONPATH
32 unset CUDDLEFISH_ROOT
34 unset VIRTUAL_ENV
35 if [ ! "$1" = "nondestructive" ] ; then
36 # Self destruct!
37 unset deactivate
38 fi
39 }
41 # unset irrelavent variables
42 deactivate nondestructive
44 _OLD_PYTHONPATH="$PYTHONPATH"
45 _OLD_VIRTUAL_PATH="$PATH"
47 VIRTUAL_ENV="`pwd`"
49 if [ "x$OSTYPE" = "xmsys" ] ; then
50 CUDDLEFISH_ROOT="`pwd -W | sed s,/,\\\\\\\\,g`"
51 PATH="`pwd`/bin:$PATH"
52 # msys will convert any env vars with PATH in it to use msys
53 # form and will unconvert before launching
54 PYTHONPATH="`pwd -W`/python-lib;$PYTHONPATH"
55 else
56 CUDDLEFISH_ROOT="$VIRTUAL_ENV"
57 PYTHONPATH="$VIRTUAL_ENV/python-lib:$PYTHONPATH"
58 PATH="$VIRTUAL_ENV/bin:$PATH"
59 fi
61 VIRTUAL_ENV="`pwd`"
63 export CUDDLEFISH_ROOT
64 export PYTHONPATH
65 export PATH
67 _OLD_VIRTUAL_PS1="$PS1"
68 if [ "`basename \"$VIRTUAL_ENV\"`" = "__" ] ; then
69 # special case for Aspen magic directories
70 # see http://www.zetadev.com/software/aspen/
71 PS1="[`basename \`dirname \"$VIRTUAL_ENV\"\``] $PS1"
72 else
73 PS1="(`basename \"$VIRTUAL_ENV\"`)$PS1"
74 fi
75 export PS1
77 # This should detect bash and zsh, which have a hash command that must
78 # be called to get it to forget past commands. Without forgetting
79 # past commands the $PATH changes we made may not be respected
80 if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then
81 hash -r
82 fi
84 python -c "from jetpack_sdk_env import welcome; welcome()"