Thu, 15 Jan 2015 15:59:08 +0100
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.fish" *from fish* |
michael@0 | 6 | # you cannot run it directly |
michael@0 | 7 | |
michael@0 | 8 | # Much of this code is based off of the activate.fish file for the |
michael@0 | 9 | # virtualenv project. http://ur1.ca/ehmd6 |
michael@0 | 10 | |
michael@0 | 11 | function deactivate -d "Exit addon-sdk and return to normal shell environment" |
michael@0 | 12 | if test -n "$_OLD_VIRTUAL_PATH" |
michael@0 | 13 | set -gx PATH $_OLD_VIRTUAL_PATH |
michael@0 | 14 | set -e _OLD_VIRTUAL_PATH |
michael@0 | 15 | end |
michael@0 | 16 | |
michael@0 | 17 | if test -n "$_OLD_PYTHONPATH" |
michael@0 | 18 | set -gx PYTHONPATH $_OLD_PYTHONPATH |
michael@0 | 19 | set -e _OLD_PYTHONPATH |
michael@0 | 20 | end |
michael@0 | 21 | |
michael@0 | 22 | if test -n "$_OLD_FISH_PROMPT_OVERRIDE" |
michael@0 | 23 | functions -e fish_prompt |
michael@0 | 24 | set -e _OLD_FISH_PROMPT_OVERRIDE |
michael@0 | 25 | . ( begin |
michael@0 | 26 | printf "function fish_prompt\n\t#" |
michael@0 | 27 | functions _old_fish_prompt |
michael@0 | 28 | end | psub ) |
michael@0 | 29 | |
michael@0 | 30 | functions -e _old_fish_prompt |
michael@0 | 31 | end |
michael@0 | 32 | |
michael@0 | 33 | set -e CUDDLEFISH_ROOT |
michael@0 | 34 | set -e VIRTUAL_ENV |
michael@0 | 35 | |
michael@0 | 36 | if test "$argv[1]" != "nondestructive" |
michael@0 | 37 | functions -e deactivate |
michael@0 | 38 | end |
michael@0 | 39 | end |
michael@0 | 40 | |
michael@0 | 41 | # unset irrelavent variables |
michael@0 | 42 | deactivate nondestructive |
michael@0 | 43 | |
michael@0 | 44 | set -gx _OLD_PYTHONPATH $PYTHONPATH |
michael@0 | 45 | set -gx _OLD_VIRTUAL_PATH $PATH |
michael@0 | 46 | set -gx _OLD_FISH_PROMPT_OVERRIDE "true" |
michael@0 | 47 | |
michael@0 | 48 | set VIRTUAL_ENV (pwd) |
michael@0 | 49 | |
michael@0 | 50 | set -gx CUDDLEFISH_ROOT $VIRTUAL_ENV |
michael@0 | 51 | set -gx PYTHONPATH "$VIRTUAL_ENV/python-lib" $PYTHONPATH |
michael@0 | 52 | set -gx PATH "$VIRTUAL_ENV/bin" $PATH |
michael@0 | 53 | |
michael@0 | 54 | # save the current fish_prompt function as the function _old_fish_prompt |
michael@0 | 55 | . ( begin |
michael@0 | 56 | printf "function _old_fish_prompt\n\t#" |
michael@0 | 57 | functions fish_prompt |
michael@0 | 58 | end | psub ) |
michael@0 | 59 | |
michael@0 | 60 | # with the original prompt function renamed, we can override with our own. |
michael@0 | 61 | function fish_prompt |
michael@0 | 62 | printf "(%s)%s%s" (basename "$VIRTUAL_ENV") (set_color normal) (_old_fish_prompt) |
michael@0 | 63 | return |
michael@0 | 64 | end |
michael@0 | 65 | |
michael@0 | 66 | python -c "from jetpack_sdk_env import welcome; welcome()" |