clean up pyenv plugin
This commit cleans up the pyenv plugin to follow the newer conventions of the other *env plugins, as well as addresses the changes made to pyenv for PATH munging.pull/1885/head
parent
3eed0f033f
commit
ec075a404a
|
|
@ -2,14 +2,33 @@
|
||||||
cite about-plugin
|
cite about-plugin
|
||||||
about-plugin 'load pyenv, if you are using it'
|
about-plugin 'load pyenv, if you are using it'
|
||||||
|
|
||||||
export PYENV_ROOT="$HOME/.pyenv"
|
# https://github.com/pyenv/pyenv
|
||||||
pathmunge "$PYENV_ROOT/bin"
|
|
||||||
|
|
||||||
if _command_exists pyenv; then
|
# Load after basher
|
||||||
eval "$(pyenv init - bash)"
|
# BASH_IT_LOAD_PRIORITY: 260
|
||||||
|
|
||||||
|
# Don't modify the environment if we can't find the tool:
|
||||||
|
# - Check if in $PATH already
|
||||||
|
# - Check if installed manually to $PYENV_ROOT
|
||||||
|
# - Check if installed manually to $HOME
|
||||||
|
_command_exists pyenv \
|
||||||
|
|| [[ -n "$PYENV_ROOT" && -x "$PYENV_ROOT/bin/pyenv" ]] \
|
||||||
|
|| [[ -x "$HOME/.pyenv/bin/pyenv" ]] \
|
||||||
|
|| return 0
|
||||||
|
|
||||||
|
# Set PYENV_ROOT, if not already set
|
||||||
|
export PYENV_ROOT="${PYENV_ROOT:-$HOME/.pyenv}"
|
||||||
|
|
||||||
|
# Add PYENV_ROOT/bin to PATH, if that's where it's installed
|
||||||
|
if ! _command_exists pyenv && [[ -x "$PYENV_ROOT/bin/pyenv" ]]; then
|
||||||
|
pathmunge "$PYENV_ROOT/bin"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#Load pyenv virtualenv if the virtualenv plugin is installed.
|
# Initialize pyenv
|
||||||
|
pathmunge "$PYENV_ROOT/shims"
|
||||||
|
eval "$(pyenv init - bash)"
|
||||||
|
|
||||||
|
# Load pyenv virtualenv if the virtualenv plugin is installed.
|
||||||
if pyenv virtualenv-init - &> /dev/null; then
|
if pyenv virtualenv-init - &> /dev/null; then
|
||||||
eval "$(pyenv virtualenv-init - bash)"
|
eval "$(pyenv virtualenv-init - bash)"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue