No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

61 líneas
1.7 KiB

hace 10 años
hace 10 años
hace 10 años
hace 10 años
  1. #!/usr/bin/env bash
  2. # Summary: Display prefixes for Python versions
  3. # Usage: pyenv prefix [<version>...]
  4. #
  5. # Displays the directories where the given Python versions are installed,
  6. # separated by colons. If no version is given, `pyenv prefix' displays the
  7. # locations of the currently selected versions.
  8. set -e
  9. [ -n "$PYENV_DEBUG" ] && set -x
  10. # Provide pyenv completions
  11. if [ "$1" = "--complete" ]; then
  12. echo system
  13. exec pyenv-versions --bare
  14. fi
  15. if [ -n "$1" ]; then
  16. OLDIFS="$IFS"
  17. { IFS=:
  18. export PYENV_VERSION="$*"
  19. }
  20. IFS="$OLDIFS"
  21. elif [ -z "$PYENV_VERSION" ]; then
  22. PYENV_VERSION="$(pyenv-version-name)"
  23. fi
  24. PYENV_PREFIX_PATHS=()
  25. OLDIFS="$IFS"
  26. { IFS=:
  27. for version in ${PYENV_VERSION}; do
  28. if [ "$version" = "system" ]; then
  29. if PYTHON_PATH="$(PYENV_VERSION="${version}" pyenv-which python 2>/dev/null)" || \
  30. PYTHON_PATH="$(PYENV_VERSION="${version}" pyenv-which python3 2>/dev/null)" || \
  31. PYTHON_PATH="$(PYENV_VERSION="${version}" pyenv-which python2 2>/dev/null)"; then
  32. shopt -s extglob
  33. # In some distros (Arch), Python can be found in sbin as well as bin
  34. PYENV_PREFIX_PATH="${PYTHON_PATH%/?(s)bin/*}"
  35. PYENV_PREFIX_PATH="${PYENV_PREFIX_PATH:-/}"
  36. else
  37. echo "pyenv: system version not found in PATH" >&2
  38. exit 1
  39. fi
  40. else
  41. PYENV_PREFIX_PATH="${PYENV_ROOT}/versions/${version}"
  42. fi
  43. if [ -d "$PYENV_PREFIX_PATH" ]; then
  44. PYENV_PREFIX_PATHS=("${PYENV_PREFIX_PATHS[@]}" "$PYENV_PREFIX_PATH")
  45. else
  46. echo "pyenv: version \`${version}' not installed" >&2
  47. exit 1
  48. fi
  49. done
  50. }
  51. IFS="$OLDIFS"
  52. OLDIFS="$IFS"
  53. { IFS=:
  54. echo "${PYENV_PREFIX_PATHS[*]}"
  55. }
  56. IFS="$OLDIFS"