MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / get_versions

Function get_versions

versioneer.py:1686–1762  ·  view source on GitHub ↗

Get the project version from whatever source is available. Returns dict with two keys: 'version' and 'full'.

(verbose=False)

Source from the content-addressed store, hash-verified

1684
1685
1686def get_versions(verbose=False):
1687 """Get the project version from whatever source is available.
1688
1689 Returns dict with two keys: 'version' and 'full'.
1690 """
1691 if "versioneer" in sys.modules:
1692 # see the discussion in cmdclass.py:get_cmdclass()
1693 del sys.modules["versioneer"]
1694
1695 root = get_root()
1696 cfg = get_config_from_root(root)
1697
1698 assert cfg.VCS is not None, "please set [versioneer]VCS= in setup.cfg"
1699 handlers = HANDLERS.get(cfg.VCS)
1700 assert handlers, "unrecognized VCS '%s'" % cfg.VCS
1701 verbose = verbose or cfg.verbose
1702 assert cfg.versionfile_source is not None, "please set versioneer.versionfile_source"
1703 assert cfg.tag_prefix is not None, "please set versioneer.tag_prefix"
1704
1705 versionfile_abs = os.path.join(root, cfg.versionfile_source)
1706
1707 # extract version from first of: _version.py, VCS command (e.g. 'git
1708 # describe'), parentdir. This is meant to work for developers using a
1709 # source checkout, for users of a tarball created by 'setup.py sdist',
1710 # and for users of a tarball/zipball created by 'git archive' or github's
1711 # download-from-tag feature or the equivalent in other VCSes.
1712
1713 get_keywords_f = handlers.get("get_keywords")
1714 from_keywords_f = handlers.get("keywords")
1715 if get_keywords_f and from_keywords_f:
1716 try:
1717 keywords = get_keywords_f(versionfile_abs)
1718 ver = from_keywords_f(keywords, cfg.tag_prefix, verbose)
1719 if verbose:
1720 print("got version from expanded keyword %s" % ver)
1721 return ver
1722 except NotThisMethod:
1723 pass
1724
1725 try:
1726 ver = versions_from_file(versionfile_abs)
1727 if verbose:
1728 print("got version from file %s %s" % (versionfile_abs, ver))
1729 return ver
1730 except NotThisMethod:
1731 pass
1732
1733 from_vcs_f = handlers.get("pieces_from_vcs")
1734 if from_vcs_f:
1735 try:
1736 pieces = from_vcs_f(cfg.tag_prefix, root, verbose)
1737 ver = render(pieces, cfg.style)
1738 if verbose:
1739 print("got version from VCS %s" % ver)
1740 return ver
1741 except NotThisMethod:
1742 pass
1743

Callers 7

get_versionFunction · 0.70
runMethod · 0.70
runMethod · 0.70
runMethod · 0.70
runMethod · 0.70
runMethod · 0.70
runMethod · 0.70

Calls 6

get_rootFunction · 0.85
get_config_from_rootFunction · 0.85
versions_from_fileFunction · 0.85
getMethod · 0.80
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…