Mercurial > repos > shellac > guppy_basecaller
comparison env/lib/python3.7/site-packages/virtualenv/activation/fish/activate.fish @ 0:26e78fe6e8c4 draft
"planemo upload commit c699937486c35866861690329de38ec1a5d9f783"
author | shellac |
---|---|
date | Sat, 02 May 2020 07:14:21 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:26e78fe6e8c4 |
---|---|
1 # This file must be used using `source bin/activate.fish` *within a running fish ( http://fishshell.com ) session*. | |
2 # Do not run it directly. | |
3 | |
4 function _bashify_path -d "Converts a fish path to something bash can recognize" | |
5 set fishy_path $argv | |
6 set bashy_path $fishy_path[1] | |
7 for path_part in $fishy_path[2..-1] | |
8 set bashy_path "$bashy_path:$path_part" | |
9 end | |
10 echo $bashy_path | |
11 end | |
12 | |
13 function _fishify_path -d "Converts a bash path to something fish can recognize" | |
14 echo $argv | tr ':' '\n' | |
15 end | |
16 | |
17 function deactivate -d 'Exit virtualenv mode and return to the normal environment.' | |
18 # reset old environment variables | |
19 if test -n "$_OLD_VIRTUAL_PATH" | |
20 # https://github.com/fish-shell/fish-shell/issues/436 altered PATH handling | |
21 if test (echo $FISH_VERSION | head -c 1) -lt 3 | |
22 set -gx PATH (_fishify_path "$_OLD_VIRTUAL_PATH") | |
23 else | |
24 set -gx PATH "$_OLD_VIRTUAL_PATH" | |
25 end | |
26 set -e _OLD_VIRTUAL_PATH | |
27 end | |
28 | |
29 if test -n "$_OLD_VIRTUAL_PYTHONHOME" | |
30 set -gx PYTHONHOME "$_OLD_VIRTUAL_PYTHONHOME" | |
31 set -e _OLD_VIRTUAL_PYTHONHOME | |
32 end | |
33 | |
34 if test -n "$_OLD_FISH_PROMPT_OVERRIDE" | |
35 and functions -q _old_fish_prompt | |
36 # Set an empty local `$fish_function_path` to allow the removal of `fish_prompt` using `functions -e`. | |
37 set -l fish_function_path | |
38 | |
39 # Erase virtualenv's `fish_prompt` and restore the original. | |
40 functions -e fish_prompt | |
41 functions -c _old_fish_prompt fish_prompt | |
42 functions -e _old_fish_prompt | |
43 set -e _OLD_FISH_PROMPT_OVERRIDE | |
44 end | |
45 | |
46 set -e VIRTUAL_ENV | |
47 | |
48 if test "$argv[1]" != 'nondestructive' | |
49 # Self-destruct! | |
50 functions -e pydoc | |
51 functions -e deactivate | |
52 functions -e _bashify_path | |
53 functions -e _fishify_path | |
54 end | |
55 end | |
56 | |
57 # Unset irrelevant variables. | |
58 deactivate nondestructive | |
59 | |
60 set -gx VIRTUAL_ENV '__VIRTUAL_ENV__' | |
61 | |
62 # https://github.com/fish-shell/fish-shell/issues/436 altered PATH handling | |
63 if test (echo $FISH_VERSION | head -c 1) -lt 3 | |
64 set -gx _OLD_VIRTUAL_PATH (_bashify_path $PATH) | |
65 else | |
66 set -gx _OLD_VIRTUAL_PATH "$PATH" | |
67 end | |
68 set -gx PATH "$VIRTUAL_ENV"'/__BIN_NAME__' $PATH | |
69 | |
70 # Unset `$PYTHONHOME` if set. | |
71 if set -q PYTHONHOME | |
72 set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME | |
73 set -e PYTHONHOME | |
74 end | |
75 | |
76 function pydoc | |
77 python -m pydoc $argv | |
78 end | |
79 | |
80 if test -z "$VIRTUAL_ENV_DISABLE_PROMPT" | |
81 # Copy the current `fish_prompt` function as `_old_fish_prompt`. | |
82 functions -c fish_prompt _old_fish_prompt | |
83 | |
84 function fish_prompt | |
85 # Run the user's prompt first; it might depend on (pipe)status. | |
86 set -l prompt (_old_fish_prompt) | |
87 | |
88 # Prompt override provided? | |
89 # If not, just prepend the environment name. | |
90 if test -n '__VIRTUAL_PROMPT__' | |
91 printf '%s%s' '__VIRTUAL_PROMPT__' (set_color normal) | |
92 else | |
93 printf '%s(%s) ' (set_color normal) (basename "$VIRTUAL_ENV") | |
94 end | |
95 | |
96 string join -- \n $prompt # handle multi-line prompts | |
97 end | |
98 | |
99 set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV" | |
100 end |