2012-01-31 23:37:51 -05:00
|
|
|
#
|
|
|
|
# Enables local Python package installation.
|
|
|
|
#
|
|
|
|
# Authors:
|
|
|
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
2012-04-12 07:06:37 -04:00
|
|
|
# Sebastian Wiesner <lunaryorn@googlemail.com>
|
2012-01-31 23:37:51 -05:00
|
|
|
#
|
|
|
|
|
2013-08-20 08:21:17 -04:00
|
|
|
# Load manually installed pyenv into the shell session.
|
|
|
|
if [[ -s "$HOME/.pyenv/bin/pyenv" ]]; then
|
|
|
|
path=("$HOME/.pyenv/bin" $path)
|
|
|
|
eval "$(pyenv init -)"
|
2012-09-25 12:57:57 -04:00
|
|
|
|
2013-08-20 08:21:17 -04:00
|
|
|
# Load package manager installed pyenv into the shell session.
|
|
|
|
elif (( $+commands[pyenv] )); then
|
|
|
|
eval "$(pyenv init -)"
|
2012-07-23 15:00:44 -04:00
|
|
|
|
2011-08-27 19:09:06 -04:00
|
|
|
# Prepend PEP 370 per user site packages directory, which defaults to
|
2014-03-17 13:31:21 -04:00
|
|
|
# ~/Library/Python on Mac OS X and ~/.local elsewhere, to PATH. The
|
|
|
|
# path can be overridden using PYTHONUSERBASE.
|
2011-08-27 19:09:06 -04:00
|
|
|
else
|
2014-03-17 13:31:21 -04:00
|
|
|
if [[ -n "$PYTHONUSERBASE" ]]; then
|
|
|
|
path=($PYTHONUSERBASE/bin $path)
|
|
|
|
elif [[ "$OSTYPE" == darwin* ]]; then
|
2013-08-20 08:21:17 -04:00
|
|
|
path=($HOME/Library/Python/*/bin(N) $path)
|
|
|
|
else
|
|
|
|
# This is subject to change.
|
|
|
|
path=($HOME/.local/bin $path)
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Return if requirements are not found.
|
|
|
|
if (( ! $+commands[python] && ! $+commands[pyenv] )); then
|
|
|
|
return 1
|
2011-08-27 19:09:06 -04:00
|
|
|
fi
|
|
|
|
|
2012-04-12 07:06:37 -04:00
|
|
|
# Load virtualenvwrapper into the shell session.
|
2012-09-03 10:53:19 -04:00
|
|
|
if (( $+commands[virtualenvwrapper_lazy.sh] )); then
|
|
|
|
# Set the directory where virtual environments are stored.
|
2013-08-20 08:21:17 -04:00
|
|
|
export WORKON_HOME="$HOME/.virtualenvs"
|
2012-09-03 10:53:19 -04:00
|
|
|
|
2012-09-03 10:34:41 -04:00
|
|
|
# Disable the virtualenv prompt.
|
|
|
|
VIRTUAL_ENV_DISABLE_PROMPT=1
|
2012-09-03 10:53:19 -04:00
|
|
|
|
2012-09-03 10:37:56 -04:00
|
|
|
source "$commands[virtualenvwrapper_lazy.sh]"
|
2012-04-12 07:06:37 -04:00
|
|
|
fi
|
|
|
|
|
2012-08-15 08:00:08 -04:00
|
|
|
#
|
|
|
|
# Aliases
|
|
|
|
#
|
|
|
|
|
|
|
|
alias py='python'
|
2012-09-02 21:14:32 -04:00
|
|
|
|