File tree 2 files changed +24
-1
lines changed 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 11
11
# See `pyenv virtualenvs` for a complete list of installed versions.
12
12
#
13
13
set -e
14
+ [ -n " $PYENV_DEBUG " ] && set -x
14
15
15
16
# Provide pyenv completions
16
17
if [ " $1 " = " --complete" ]; then
@@ -54,11 +55,16 @@ COMPAT_PREFIX="${PYENV_ROOT}/versions/${VERSION_NAME}"
54
55
55
56
if [[ " ${DEFINITION} " != " ${DEFINITION%/ envs/* } " ]]; then
56
57
PREFIX=" ${PYENV_ROOT} /versions/${DEFINITION} "
58
+ if [ -L " ${COMPAT_PREFIX} " ]; then
59
+ if [[ " ${PREFIX} " != " $( resolve_link " ${COMPAT_PREFIX} " 2> /dev/null || true) " ]]; then
60
+ unset COMPAT_PREFIX
61
+ fi
62
+ fi
57
63
else
58
64
if [ -L " ${COMPAT_PREFIX} " ]; then
59
65
PREFIX=" $( resolve_link " ${COMPAT_PREFIX} " 2> /dev/null || true) "
60
66
if [[ " ${PREFIX} " == " ${PREFIX%/ envs/* } " ]]; then
61
- echo " pyenv-virtualenv: \` ${PREFIX } ' is a symlink for unknown location." 1>&2
67
+ echo " pyenv-virtualenv: \` ${COMPAT_PREFIX } ' is a symlink for unknown location." 1>&2
62
68
exit 1
63
69
fi
64
70
else
Original file line number Diff line number Diff line change @@ -54,6 +54,23 @@ setup() {
54
54
[ ! -L " ${PYENV_ROOT} /versions/venv27" ]
55
55
}
56
56
57
+ @test " not delete virtualenv with different symlink" {
58
+ mkdir -p " ${PYENV_ROOT} /versions/2.7.8/envs/venv27"
59
+ mkdir -p " ${PYENV_ROOT} /versions/2.7.10/envs/venv27"
60
+ ln -fs " ${PYENV_ROOT} /versions/2.7.8/envs/venv27" " ${PYENV_ROOT} /versions/venv27"
61
+
62
+ stub pyenv-rehash " true"
63
+
64
+ run pyenv-virtualenv-delete -f " 2.7.10/envs/venv27"
65
+
66
+ assert_success
67
+
68
+ unstub pyenv-rehash
69
+
70
+ [ ! -d " ${PYENV_ROOT} /versions/2.7.10/envs/venv27" ]
71
+ [ -L " ${PYENV_ROOT} /versions/venv27" ]
72
+ }
73
+
57
74
@test " not delete virtualenv with same name" {
58
75
mkdir -p " ${PYENV_ROOT} /versions/2.7.10/envs/venv27"
59
76
mkdir -p " ${PYENV_ROOT} /versions/venv27"
You can’t perform that action at this time.
0 commit comments