addon-sdk/source/bin/activate

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

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

mercurial