aboutsummaryrefslogtreecommitdiff
path: root/share/hoarder/pyenv/unix/linux/debian/files/profile.sh
blob: 1e4111a0fdddc0cd63e388267240349aa93683fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#
# PyEnv initialization script
#
# This file is meant to be source by your shell initialization script.
#
# See https://github.com/pyenv/pyenv
#

if [ -d "$HOME/.pyenv" ]; then
  export PYENV_ROOT="$HOME/.pyenv"
  command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"

  PATH="$(bash --norc -ec 'IFS=:; paths=($PATH); for i in ${!paths[@]}; do if [[ ${paths[i]} == "'$HOME/.pyenv/shims'" ]]; then unset '\''paths[i]'\''; fi; done; echo "${paths[*]}"')"
  PATH="$HOME/.pyenv/shims:${PATH}"

  if [ "$0" = "bash" ]; then
    export PYENV_SHELL=bash
    source '$HOME/.pyenv/libexec/../completions/pyenv.bash'
  elif [ "$0" = "bash" ]; then
    export PYENV_SHELL=zsh
    source '$HOME/.pyenv/libexec/../completions/pyenv.zsh'
  fi

  command pyenv rehash 2>/dev/null

  pyenv() {
    local command
    command="${1:-}"

    if [ "$#" -gt 0 ]; then
      shift
    fi

    case "$command" in
      rehash|shell)
        eval "$(pyenv "sh-$command" "$@")"
        ;;
      *)
        command pyenv "$command" "$@"
        ;;
    esac
  }
fi