#!/usr/bin/env bash # # Summary: Deactivate virtual environment # # Usage: pyenv deactivate # # Deactivate a Python virtual environment. set -e [ -n "$PYENV_DEBUG" ] && set -x unset FORCE unset QUIET unset VERBOSE while [ $# -gt 0 ]; do case "$1" in "--force" ) FORCE=1 ;; "--no-error" | "--quiet") QUIET=1 ;; "--verbose" ) VERBOSE=1 ;; * ) break ;; esac shift 1 done if [ -z "${VIRTUAL_ENV}" ]; then if [ -z "$QUIET" ]; then echo "pyenv-virtualenv: no virtualenv has been activated." 1>&2 fi echo "false" exit 1 fi shell="$(basename "${PYENV_SHELL:-$SHELL}")" prefix="${VIRTUAL_ENV}" if [[ "${prefix}" != "${prefix%/envs/*}" ]]; then venv="$(basename "${prefix%/envs/*}")/envs/${prefix##*/}" else venv="${prefix##*/}" fi echo "pyenv-virtualenv: deactivate ${venv}" 1>&2 if [ -n "${PYENV_ACTIVATE_SHELL}" ]; then # shell version set in pyenv-sh-activate should be unset # https://github.com/yyuu/pyenv-virtualenv/issues/61 case "$shell" in fish ) cat <