|
|
@ -7,18 +7,16 @@
|
|
|
|
# Patrick Bos <egpbos@gmail.com>
|
|
|
|
# Patrick Bos <egpbos@gmail.com>
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Load dependencies
|
|
|
|
|
|
|
|
pmodload 'helper'
|
|
|
|
|
|
|
|
|
|
|
|
# Load manually installed pyenv into the path
|
|
|
|
# Load manually installed pyenv into the path
|
|
|
|
if [[ -n "$PYENV_ROOT" && -s "$PYENV_ROOT/bin/pyenv" ]]; then
|
|
|
|
if [[ -s "${PYENV_ROOT:=$HOME/.pyenv}/bin/pyenv" ]]; then
|
|
|
|
path=("$PYENV_ROOT/bin" $path)
|
|
|
|
path=("${PYENV_ROOT}/bin" $path)
|
|
|
|
elif [[ -s "$HOME/.pyenv/bin/pyenv" ]]; then
|
|
|
|
eval "$(pyenv init - --no-rehash zsh)"
|
|
|
|
path=("$HOME/.pyenv/bin" $path)
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Load pyenv into the current python session
|
|
|
|
# Load pyenv into the current python session
|
|
|
|
if (( $+commands[pyenv] )); then
|
|
|
|
elif (( $+commands[pyenv] )); then
|
|
|
|
if [[ -z "$PYENV_ROOT" ]]; then
|
|
|
|
|
|
|
|
export PYENV_ROOT=$(pyenv root)
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
eval "$(pyenv init - --no-rehash zsh)"
|
|
|
|
eval "$(pyenv init - --no-rehash zsh)"
|
|
|
|
|
|
|
|
|
|
|
|
# Prepend PEP 370 per user site packages directory, which defaults to
|
|
|
|
# Prepend PEP 370 per user site packages directory, which defaults to
|
|
|
@ -27,7 +25,7 @@ if (( $+commands[pyenv] )); then
|
|
|
|
else
|
|
|
|
else
|
|
|
|
if [[ -n "$PYTHONUSERBASE" ]]; then
|
|
|
|
if [[ -n "$PYTHONUSERBASE" ]]; then
|
|
|
|
path=($PYTHONUSERBASE/bin $path)
|
|
|
|
path=($PYTHONUSERBASE/bin $path)
|
|
|
|
elif [[ "$OSTYPE" == darwin* ]]; then
|
|
|
|
elif is-darwin; then
|
|
|
|
path=($HOME/Library/Python/*/bin(N) $path)
|
|
|
|
path=($HOME/Library/Python/*/bin(N) $path)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
# This is subject to change.
|
|
|
|
# This is subject to change.
|
|
|
@ -150,7 +148,7 @@ fi
|
|
|
|
|
|
|
|
|
|
|
|
# Load PIP completion.
|
|
|
|
# Load PIP completion.
|
|
|
|
if (( $#commands[(i)pip(|[23])] )); then
|
|
|
|
if (( $#commands[(i)pip(|[23])] )); then
|
|
|
|
cache_file="${TMPDIR:-/tmp}/prezto-pip-cache.$UID.zsh"
|
|
|
|
cache_file="${XDG_CACHE_HOME:-$HOME/.cache}/prezto/pip-cache.zsh"
|
|
|
|
|
|
|
|
|
|
|
|
# Detect and use one available from among 'pip', 'pip2', 'pip3' variants
|
|
|
|
# Detect and use one available from among 'pip', 'pip2', 'pip3' variants
|
|
|
|
pip_command="$commands[(i)pip(|[23])]"
|
|
|
|
pip_command="$commands[(i)pip(|[23])]"
|
|
|
@ -158,6 +156,7 @@ if (( $#commands[(i)pip(|[23])] )); then
|
|
|
|
if [[ "$pip_command" -nt "$cache_file" \
|
|
|
|
if [[ "$pip_command" -nt "$cache_file" \
|
|
|
|
|| "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" \
|
|
|
|
|| "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" \
|
|
|
|
|| ! -s "$cache_file" ]]; then
|
|
|
|
|| ! -s "$cache_file" ]]; then
|
|
|
|
|
|
|
|
mkdir -p "$cache_file:h"
|
|
|
|
# pip is slow; cache its output. And also support 'pip2', 'pip3' variants
|
|
|
|
# pip is slow; cache its output. And also support 'pip2', 'pip3' variants
|
|
|
|
$pip_command completion --zsh \
|
|
|
|
$pip_command completion --zsh \
|
|
|
|
| sed -e "s/\(compctl -K [-_[:alnum:]]* pip\).*/\1{,2,3}{,.{0..9}}/" \
|
|
|
|
| sed -e "s/\(compctl -K [-_[:alnum:]]* pip\).*/\1{,2,3}{,.{0..9}}/" \
|
|
|
|