Fix add_to_path/pyenv interaction in shellenv.sh

This commit is contained in:
Ivan Malison 2016-08-02 20:46:42 -07:00
parent 2bff927eca
commit d624955ee2
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8

View File

@ -8,8 +8,15 @@ function _source_shellenv_files {
}
function add_to_path {
local python_command
local result
result=$($HOME/.lib/python/shell_path.py --include-assignment "$@")
# We need to get a path to the ACTUAL python command because
# pyenv alters PATH before actually executing python, which ends
# up changing PATH in a way that is not desireable.
hash pyenv && python_command="$(pyenv which python)" || python_command="$(which python)"
result=$($python_command $HOME/.lib/python/shell_path.py --include-assignment "$@")
eval "$result"
}
@ -53,7 +60,7 @@ function _python_setup {
local PYENV_INIT_COMMANDS="$(pyenv init -)"
eval "$PYENV_INIT_COMMANDS"
else
echo "WARNING: pyenv is installed on this machine and python will likely not function correctly"
echo "WARNING: pyenv not is installed on this machine and python will likely not function correctly"
fi
# The following line is no longer necessary since the pyenv shim