addon-sdk/source/bin/activate

branch
TOR_BUG_9701
changeset 10
ac0c01689b40
equal deleted inserted replaced
-1:000000000000 0:c34b7470b3dd
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/.
4
5 # This file must be used with "source bin/activate" *from bash*
6 # you cannot run it directly
7
8 deactivate () {
9 if [ -n "$_OLD_VIRTUAL_PATH" ] ; then
10 PATH="$_OLD_VIRTUAL_PATH"
11 export PATH
12 unset _OLD_VIRTUAL_PATH
13 fi
14
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
21
22 if [ -n "$_OLD_VIRTUAL_PS1" ] ; then
23 PS1="$_OLD_VIRTUAL_PS1"
24 export PS1
25 unset _OLD_VIRTUAL_PS1
26 fi
27
28 PYTHONPATH="$_OLD_PYTHONPATH"
29 export PYTHONPATH
30 unset _OLD_PYTHONPATH
31
32 unset CUDDLEFISH_ROOT
33
34 unset VIRTUAL_ENV
35 if [ ! "$1" = "nondestructive" ] ; then
36 # Self destruct!
37 unset deactivate
38 fi
39 }
40
41 # unset irrelavent variables
42 deactivate nondestructive
43
44 _OLD_PYTHONPATH="$PYTHONPATH"
45 _OLD_VIRTUAL_PATH="$PATH"
46
47 VIRTUAL_ENV="`pwd`"
48
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
60
61 VIRTUAL_ENV="`pwd`"
62
63 export CUDDLEFISH_ROOT
64 export PYTHONPATH
65 export PATH
66
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
76
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
83
84 python -c "from jetpack_sdk_env import welcome; welcome()"

mercurial