MCPcopy Create free account
hub / github.com/shapely/shapely / get_versions

Function get_versions

shapely/_version.py:644–693  ·  view source on GitHub ↗

Get version information or return default if unable to do so.

()

Source from the content-addressed store, hash-verified

642
643
644def get_versions():
645 """Get version information or return default if unable to do so."""
646 # I am in _version.py, which lives at ROOT/VERSIONFILE_SOURCE. If we have
647 # __file__, we can work backwards from there to the root. Some
648 # py2exe/bbfreeze/non-CPython implementations don't do __file__, in which
649 # case we can only use expanded keywords.
650
651 cfg = get_config()
652 verbose = cfg.verbose
653
654 try:
655 return git_versions_from_keywords(get_keywords(), cfg.tag_prefix, verbose)
656 except NotThisMethod:
657 pass
658
659 try:
660 root = os.path.realpath(__file__)
661 # versionfile_source is the relative path from the top of the source
662 # tree (where the .git directory might live) to this file. Invert
663 # this to find the root from __file__.
664 for _ in cfg.versionfile_source.split("/"):
665 root = os.path.dirname(root)
666 except NameError:
667 return {
668 "version": "0+unknown",
669 "full-revisionid": None,
670 "dirty": None,
671 "error": "unable to find root of source tree",
672 "date": None,
673 }
674
675 try:
676 pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose)
677 return render(pieces, cfg.style)
678 except NotThisMethod:
679 pass
680
681 try:
682 if cfg.parentdir_prefix:
683 return versions_from_parentdir(cfg.parentdir_prefix, root, verbose)
684 except NotThisMethod:
685 pass
686
687 return {
688 "version": "0+unknown",
689 "full-revisionid": None,
690 "dirty": None,
691 "error": "unable to compute version",
692 "date": None,
693 }

Callers

nothing calls this directly

Calls 7

get_configFunction · 0.85
get_keywordsFunction · 0.85
splitMethod · 0.80
git_pieces_from_vcsFunction · 0.70
renderFunction · 0.70
versions_from_parentdirFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…