Closed stevenxxiu closed 2 years ago
I managed to make an ugly temporary fix for this now. Put this in at the end of ~/.zshrc
:
# Disable `autoswitch_virtualenv` in subdirectories it doesn't work in
functions[check_venv_orig]=$functions[check_venv]
function check_venv() {
if [[ $PWD/ = /usr/share/webapps/gitlab/* ]]; then
return
fi
check_venv_orig "$@"
}
What does this directly contain? Is it an installation of gitlab
? Is there any way you can reproduce this in a docker container so that I can test and debug?
Ah I debugged it a bit and think I get the issue. The bug happens when I don't have pipenv
installed, and the directory has a Pipfile
in it. Its contents don't really matter, but fyi it's shown in my first comment.
When this happens, the first condition below in autoswitch_virtualenv.plugin.zsh
doesn't evaluate to true
, and the else
part is ran instead. This isn't really valid:
if [[ "$venv_path" == *"/Pipfile" ]] && type "pipenv" > /dev/null; then
if _activate_pipenv; then
return
fi
elif [[ "$venv_path" == *"/poetry.lock" ]] && type "poetry" > /dev/null; then
if _activate_poetry; then
return
fi
else
local switch_to="$(<"$venv_path")"
_maybeworkon "$(_virtual_env_dir "$switch_to")" "virtualenv"
return
fi
And yes, it's just an installation of gitlab
. It happens in any directory with a Pipfile
in it, if pipenv
isn't installed.
The same could be set if the directory has a poetry.lock
in it, and poetry
isn't installed.
Fixed in 3.3.2
Thanks for the fix @stevenxxiu !
Issue Details
When I go in the
gitlab
directory the following invalid warning always shows up:The file that causes this is:
Operating System (uname -a)
Arch Linux
zsh version (zsh --version)
autoswitch-virtualenv version
How is zsh-autoswitch-virtualenv installed?