mirror of
https://github.com/pyenv/pyenv-virtualenv.git
synced 2025-11-08 11:33:55 -05:00
Support deletion of virtualenv created in envs
This commit is contained in:
21
etc/pyenv.d/uninstall/envs.bash
Normal file
21
etc/pyenv.d/uninstall/envs.bash
Normal file
@@ -0,0 +1,21 @@
|
||||
resolve_link() {
|
||||
$(type -p greadlink readlink | head -1) "$1"
|
||||
}
|
||||
|
||||
if [ -n "${DEFINITION}" ]; then
|
||||
if [[ "${DEFINITION}" != "${DEFINITION%/envs/*}" ]]; then
|
||||
exec pyenv-virtualenv-delete ${FORCE+-f} "${DEFINITION}"
|
||||
exit 128
|
||||
else
|
||||
VERSION_NAME="${VERSION_NAME:-${DEFINITION##*/}}"
|
||||
PREFIX="${PREFIX:-${PYENV_ROOT}/versions/${VERSION_NAME}}"
|
||||
if [ -L "${PREFIX}" ]; then
|
||||
REAL_PREFIX="$(resolve_link "${PREFIX}" 2>/dev/null || true)"
|
||||
REAL_DEFINITION="${REAL_PREFIX#${PYENV_ROOT}/versions/}"
|
||||
if [[ "${REAL_DEFINITION}" != "${REAL_DEFINITION%/envs/*}" ]]; then
|
||||
exec pyenv-virtualenv-delete ${FORCE+-f} "${REAL_DEFINITION}"
|
||||
exit 128
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
Reference in New Issue
Block a user