Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

33 řádky
817 B

  1. #!/usr/bin/env bash
  2. # Summary: Detect the file that sets the current pyenv version
  3. set -e
  4. [ -n "$PYENV_DEBUG" ] && set -x
  5. find_local_version_file() {
  6. local root="$1"
  7. while [ -n "$root" ]; do
  8. if [ -e "${root}/.python-version" ]; then
  9. echo "${root}/.python-version"
  10. exit
  11. elif [ -e "${root}/.pyenv-version" ]; then
  12. echo "${root}/.pyenv-version"
  13. exit
  14. fi
  15. root="${root%/*}"
  16. done
  17. }
  18. find_local_version_file "$PYENV_DIR"
  19. [ "$PYENV_DIR" = "$PWD" ] || find_local_version_file "$PWD"
  20. global_version_file="${PYENV_ROOT}/version"
  21. if [ -e "$global_version_file" ]; then
  22. echo "$global_version_file"
  23. elif [ -e "${PYENV_ROOT}/global" ]; then
  24. echo "${PYENV_ROOT}/global"
  25. elif [ -e "${PYENV_ROOT}/default" ]; then
  26. echo "${PYENV_ROOT}/default"
  27. else
  28. echo "$global_version_file"
  29. fi