Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Side by Side Diff: bootstrap/virtualenv/virtualenv_embedded/activate.fish

Issue 2043213002: Roll virtualenv 12.0->15.0.2 (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: vendor virtualenv and exclude from gender check Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # This file must be used using `. bin/activate.fish` *within a running fish ( ht tp://fishshell.com ) session*.
2 # Do not run it directly.
3
4 function deactivate -d 'Exit virtualenv mode and return to the normal environmen t.'
5 # reset old environment variables
6 if test -n "$_OLD_VIRTUAL_PATH"
7 set -gx PATH $_OLD_VIRTUAL_PATH
8 set -e _OLD_VIRTUAL_PATH
9 end
10
11 if test -n "$_OLD_VIRTUAL_PYTHONHOME"
12 set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME
13 set -e _OLD_VIRTUAL_PYTHONHOME
14 end
15
16 if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
17 # Set an empty local `$fish_function_path` to allow the removal of `fish _prompt` using `functions -e`.
18 set -l fish_function_path
19
20 # Erase virtualenv's `fish_prompt` and restore the original.
21 functions -e fish_prompt
22 functions -c _old_fish_prompt fish_prompt
23 functions -e _old_fish_prompt
24 set -e _OLD_FISH_PROMPT_OVERRIDE
25 end
26
27 set -e VIRTUAL_ENV
28
29 if test "$argv[1]" != 'nondestructive'
30 # Self-destruct!
31 functions -e pydoc
32 functions -e deactivate
33 end
34 end
35
36 # Unset irrelevant variables.
37 deactivate nondestructive
38
39 set -gx VIRTUAL_ENV "__VIRTUAL_ENV__"
40
41 set -gx _OLD_VIRTUAL_PATH $PATH
42 set -gx PATH "$VIRTUAL_ENV/__BIN_NAME__" $PATH
43
44 # Unset `$PYTHONHOME` if set.
45 if set -q PYTHONHOME
46 set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
47 set -e PYTHONHOME
48 end
49
50 function pydoc
51 python -m pydoc $argv
52 end
53
54 if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
55 # Copy the current `fish_prompt` function as `_old_fish_prompt`.
56 functions -c fish_prompt _old_fish_prompt
57
58 function fish_prompt
59 # Save the current $status, for fish_prompts that display it.
60 set -l old_status $status
61
62 # Prompt override provided?
63 # If not, just prepend the environment name.
64 if test -n "__VIRTUAL_PROMPT__"
65 printf '%s%s' "__VIRTUAL_PROMPT__" (set_color normal)
66 else
67 printf '%s(%s) ' (set_color normal) (basename "$VIRTUAL_ENV")
68 end
69
70 # Restore the original $status
71 echo "exit $old_status" | source
72 _old_fish_prompt
73 end
74
75 set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
76 end
OLDNEW
« no previous file with comments | « bootstrap/virtualenv/virtualenv_embedded/activate.csh ('k') | bootstrap/virtualenv/virtualenv_embedded/activate.ps1 » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698