From 143b1b5362956a89988c665457c1ffd3155881a6 Mon Sep 17 00:00:00 2001 From: arshavindn Date: Mon, 20 Aug 2018 14:07:10 +0700 Subject: [PATCH] no need optional pyenv init --- modules/python/init.zsh | 46 ++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/modules/python/init.zsh b/modules/python/init.zsh index b600b270..96047c1b 100644 --- a/modules/python/init.zsh +++ b/modules/python/init.zsh @@ -7,32 +7,30 @@ # Patrick Bos # -if zstyle -t ':prezto:module:python:pyenv' auto-init 'yes'; then - # Load manually installed pyenv into the shell session. - if [[ -s "$HOME/.pyenv/bin/pyenv" ]] && (( ! $+commands[pyenv] )); then - path=("$HOME/.pyenv/bin" $path) - export PYENV_ROOT=$(pyenv root) +# Load manually installed pyenv into the shell session. +if [[ -s "$HOME/.pyenv/bin/pyenv" ]] && (( ! $+commands[pyenv] )); then + path=("$HOME/.pyenv/bin" $path) + export PYENV_ROOT=$(pyenv root) +fi + +# Return if requirements are not found. +if (( ! $+commands[python] && ! $+commands[pyenv] )); then + return 1 +elif (( $+commands[python] )); then + if (( $+commands[pyenv] )) && [[ -z "$PYENV_SHELL" ]]; then + eval "$(pyenv init - --no-rehash zsh)" fi - # Return if requirements are not found. - if (( ! $+commands[python] && ! $+commands[pyenv] )); then - return 1 - elif (( $+commands[python] )); then - if (( $+commands[pyenv] )) && [[ -z "$PYENV_SHELL" ]]; then - eval "$(pyenv init - --no-rehash zsh)" - fi - - # Prepend PEP 370 per user site packages directory, which defaults to - # ~/Library/Python on macOS and ~/.local elsewhere, to PATH. The - # path can be overridden using PYTHONUSERBASE. - if [[ -n "$PYTHONUSERBASE" ]]; then - path=($PYTHONUSERBASE/bin $path) - elif [[ "$OSTYPE" == darwin* ]]; then - path=($HOME/Library/Python/*/bin(N) $path) - else - # This is subject to change. - path=($HOME/.local/bin $path) - fi + # Prepend PEP 370 per user site packages directory, which defaults to + # ~/Library/Python on macOS and ~/.local elsewhere, to PATH. The + # path can be overridden using PYTHONUSERBASE. + if [[ -n "$PYTHONUSERBASE" ]]; then + path=($PYTHONUSERBASE/bin $path) + elif [[ "$OSTYPE" == darwin* ]]; then + path=($HOME/Library/Python/*/bin(N) $path) + else + # This is subject to change. + path=($HOME/.local/bin $path) fi fi