Mercurial > repos > guerler > hhblits
annotate bin/activate @ 0:9e54283cc701 draft
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
author | guerler |
---|---|
date | Mon, 27 Jul 2020 03:47:31 -0400 |
parents | |
children |
rev | line source |
---|---|
0
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
1 # This file must be used with "source bin/activate" *from bash* |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
2 # you cannot run it directly |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
3 |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
4 |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
5 if [ "${BASH_SOURCE-}" = "$0" ]; then |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
6 echo "You must source this script: \$ source $0" >&2 |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
7 exit 33 |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
8 fi |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
9 |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
10 deactivate () { |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
11 unset -f pydoc >/dev/null 2>&1 |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
12 |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
13 # reset old environment variables |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
14 # ! [ -z ${VAR+_} ] returns true if VAR is declared at all |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
15 if ! [ -z "${_OLD_VIRTUAL_PATH:+_}" ] ; then |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
16 PATH="$_OLD_VIRTUAL_PATH" |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
17 export PATH |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
18 unset _OLD_VIRTUAL_PATH |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
19 fi |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
20 if ! [ -z "${_OLD_VIRTUAL_PYTHONHOME+_}" ] ; then |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
21 PYTHONHOME="$_OLD_VIRTUAL_PYTHONHOME" |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
22 export PYTHONHOME |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
23 unset _OLD_VIRTUAL_PYTHONHOME |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
24 fi |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
25 |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
26 # This should detect bash and zsh, which have a hash command that must |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
27 # be called to get it to forget past commands. Without forgetting |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
28 # past commands the $PATH changes we made may not be respected |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
29 if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
30 hash -r 2>/dev/null |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
31 fi |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
32 |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
33 if ! [ -z "${_OLD_VIRTUAL_PS1+_}" ] ; then |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
34 PS1="$_OLD_VIRTUAL_PS1" |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
35 export PS1 |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
36 unset _OLD_VIRTUAL_PS1 |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
37 fi |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
38 |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
39 unset VIRTUAL_ENV |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
40 if [ ! "${1-}" = "nondestructive" ] ; then |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
41 # Self destruct! |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
42 unset -f deactivate |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
43 fi |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
44 } |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
45 |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
46 # unset irrelevant variables |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
47 deactivate nondestructive |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
48 |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
49 VIRTUAL_ENV='/Users/guerler/hh-suite' |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
50 export VIRTUAL_ENV |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
51 |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
52 _OLD_VIRTUAL_PATH="$PATH" |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
53 PATH="$VIRTUAL_ENV/bin:$PATH" |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
54 export PATH |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
55 |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
56 # unset PYTHONHOME if set |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
57 if ! [ -z "${PYTHONHOME+_}" ] ; then |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
58 _OLD_VIRTUAL_PYTHONHOME="$PYTHONHOME" |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
59 unset PYTHONHOME |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
60 fi |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
61 |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
62 if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT-}" ] ; then |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
63 _OLD_VIRTUAL_PS1="${PS1-}" |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
64 if [ "x" != x ] ; then |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
65 PS1="${PS1-}" |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
66 else |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
67 PS1="(`basename \"$VIRTUAL_ENV\"`) ${PS1-}" |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
68 fi |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
69 export PS1 |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
70 fi |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
71 |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
72 # Make sure to unalias pydoc if it's already there |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
73 alias pydoc 2>/dev/null >/dev/null && unalias pydoc || true |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
74 |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
75 pydoc () { |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
76 python -m pydoc "$@" |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
77 } |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
78 |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
79 # This should detect bash and zsh, which have a hash command that must |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
80 # be called to get it to forget past commands. Without forgetting |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
81 # past commands the $PATH changes we made may not be respected |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
82 if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
83 hash -r 2>/dev/null |
9e54283cc701
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
guerler
parents:
diff
changeset
|
84 fi |