addon-sdk/source/bin/activate.fish

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

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

mercurial