mirror of
https://github.com/pyenv/pyenv-virtualenv.git
synced 2025-11-14 22:43:52 -05:00
check existence of ./bin/activate to detect virtualenvs to support pyvenv
This commit is contained in:
@@ -23,20 +23,16 @@ print_version() {
|
||||
if [ -n "${BARE}" ]; then
|
||||
echo "${version}"
|
||||
else
|
||||
echo "${version} (created from $(pyenv-virtualenv-prefix "${version}"))"
|
||||
local prefix="$(pyenv-virtualenv-prefix "${version}")"
|
||||
echo "${version} (created from ${prefix:-unknown})"
|
||||
fi
|
||||
}
|
||||
|
||||
virtualenv_version() {
|
||||
local version="$1"
|
||||
local prefix="$(pyenv-prefix "${version}")"
|
||||
[ -f "${prefix}/bin/activate" ] && "${prefix}/bin/python" -c 'import sys;sys.real_prefix' 1>/dev/null 2>&1
|
||||
}
|
||||
|
||||
versions=($(pyenv-versions --bare))
|
||||
|
||||
for version in "${versions[@]}"; do
|
||||
if virtualenv_version "${version}"; then
|
||||
prefix="$(pyenv-prefix "${version}")"
|
||||
if [ -f "${prefix}/bin/activate" ]; then
|
||||
print_version "${version}"
|
||||
fi
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user