You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
734 B

8 years ago
  1. #!/usr/bin/env bash
  2. # Summary: Display the version of pyenv
  3. #
  4. # Displays the version number of this pyenv release, including the
  5. # current revision from git, if available.
  6. #
  7. # The format of the git revision is:
  8. # <version>-<num_commits>-<git_sha>
  9. # where `num_commits` is the number of commits since `version` was
  10. # tagged.
  11. set -e
  12. [ -n "$PYENV_DEBUG" ] && set -x
  13. version="20151124"
  14. git_revision=""
  15. for source_dir in "${BASH_SOURCE%/*}" "$PYENV_ROOT"; do
  16. if cd "$source_dir" 2>/dev/null && git remote -v 2>/dev/null | grep -q pyenv; then
  17. git_revision="$(git describe --tags HEAD 2>/dev/null || true)"
  18. git_revision="${git_revision#v}"
  19. [ -z "$git_revision" ] || break
  20. fi
  21. done
  22. echo "pyenv ${git_revision:-$version}"