File tree 5 files changed +11
-26
lines changed 5 files changed +11
-26
lines changed Original file line number Diff line number Diff line change @@ -86,13 +86,7 @@ version.
86
86
Some external tools (e.g. [ jedi] ( https://github.com/davidhalter/jedi ) ) might require you to ` activate ` the virtualenv.
87
87
` pyenv activate ` lets you to activate the virtualenv into your shell.
88
88
89
- $ pyenv activate venv27
90
-
91
- ` pyenv activate ` acts almost like following commands.
92
- The activate'd virtualenv will be persisted as _ shell_ version.
93
-
94
- $ pyenv shell venv27
95
- $ source "$(pyenv prefix venv27)/bin/activate"
89
+ $ pyenv activate
96
90
97
91
### Deactivate virtualenv
98
92
@@ -105,13 +99,6 @@ This is prepared for similality between other `pyenv` commands like `shell` and
105
99
106
100
$ pyenv activate --unset
107
101
108
- ` pyenv deactivate ` acts almost like following commands.
109
- You can also use virtualenv's ` deactivate ` in place of ` pyenv deactivate ` ,
110
- but be careful with the _ shell_ version because it will be persisted even if ` deactivate ` has invoked.
111
-
112
- $ deactivate
113
- $ pyenv shell --unset
114
-
115
102
### Special environment variables
116
103
117
104
You can set certain environment variables to control the pyenv-virtualenv.
Original file line number Diff line number Diff line change @@ -26,9 +26,8 @@ if [ "$1" = "--unset" ]; then
26
26
fi
27
27
28
28
versions=(" $@ " )
29
- shell=" $( basename " ${PYENV_SHELL:- $SHELL } " ) "
30
-
31
29
if [ -z " $versions " ]; then
30
+ no_shell=1
32
31
OLDIFS=" $IFS "
33
32
IFS=: versions=($( pyenv-version-name) )
34
33
IFS=" $OLDIFS "
41
40
42
41
pyenv-virtualenv-prefix " ${versions} " 1> /dev/null
43
42
44
- echo " pyenv shell \" ${versions} \" ;"
43
+ if [ -z " $no_shell " ]; then
44
+ echo " pyenv shell \" ${versions} \" ;"
45
+ fi
46
+
47
+ shell=" $( basename " ${PYENV_SHELL:- $SHELL } " ) "
45
48
case " $shell " in
46
49
fish ) echo " . \" $( pyenv-prefix " ${versions} " ) /bin/activate.fish\" " ;;
47
50
* ) echo " source \" $( pyenv-prefix " ${versions} " ) /bin/activate\" " ;;
Original file line number Diff line number Diff line change 11
11
12
12
shell=" $( basename " ${PYENV_SHELL:- $SHELL } " ) "
13
13
case " $shell " in
14
- fish ) echo " functions -q deactivate; and deactivate; " ;;
15
- * ) echo " declare -f deactivate 1>/dev/null 2>&1 && deactivate; " ;;
14
+ fish ) echo " functions -q deactivate; and deactivate" ;;
15
+ * ) echo " declare -f deactivate 1>/dev/null 2>&1 && deactivate" ;;
16
16
esac
17
- echo " pyenv shell --unset"
Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ setup() {
19
19
20
20
assert_success
21
21
assert_output << EOS
22
- pyenv shell "venv";
23
22
source "${PYENV_ROOT} /versions/venv/bin/activate"
24
23
EOS
25
24
}
37
36
38
37
assert_success
39
38
assert_output << EOS
40
- pyenv shell "venv";
41
39
. "${PYENV_ROOT} /versions/venv/bin/activate.fish"
42
40
EOS
43
41
}
Original file line number Diff line number Diff line change @@ -11,8 +11,7 @@ setup() {
11
11
12
12
assert_success
13
13
assert_output << EOS
14
- declare -f deactivate 1>/dev/null 2>&1 && deactivate;
15
- pyenv shell --unset
14
+ declare -f deactivate 1>/dev/null 2>&1 && deactivate
16
15
EOS
17
16
}
18
17
21
20
22
21
assert_success
23
22
assert_output << EOS
24
- functions -q deactivate; and deactivate;
25
- pyenv shell --unset
23
+ functions -q deactivate; and deactivate
26
24
EOS
27
25
}
28
26
You can’t perform that action at this time.
0 commit comments