Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

34 rindas
859 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%/*}" ] && break
  16. root="${root%/*}"
  17. done
  18. }
  19. find_local_version_file "$PYENV_DIR"
  20. [ "$PYENV_DIR" = "$PWD" ] || find_local_version_file "$PWD"
  21. global_version_file="${PYENV_ROOT}/version"
  22. if [ -e "$global_version_file" ]; then
  23. echo "$global_version_file"
  24. elif [ -e "${PYENV_ROOT}/global" ]; then
  25. echo "${PYENV_ROOT}/global"
  26. elif [ -e "${PYENV_ROOT}/default" ]; then
  27. echo "${PYENV_ROOT}/default"
  28. else
  29. echo "$global_version_file"
  30. fi