MCPcopy
hub / github.com/quantopian/zipline / get_versions

Function get_versions

versioneer.py:1331–1401  ·  view source on GitHub ↗
(verbose=False)

Source from the content-addressed store, hash-verified

1329
1330
1331def get_versions(verbose=False):
1332 # returns dict with two keys: 'version' and 'full'
1333
1334 if "versioneer" in sys.modules:
1335 # see the discussion in cmdclass.py:get_cmdclass()
1336 del sys.modules["versioneer"]
1337
1338 root = get_root()
1339 cfg = get_config_from_root(root)
1340
1341 assert cfg.VCS is not None, "please set [versioneer]VCS= in setup.cfg"
1342 handlers = HANDLERS.get(cfg.VCS)
1343 assert handlers, "unrecognized VCS '%s'" % cfg.VCS
1344 verbose = verbose or cfg.verbose
1345 assert cfg.versionfile_source is not None, \
1346 "please set versioneer.versionfile_source"
1347 assert cfg.tag_prefix is not None, "please set versioneer.tag_prefix"
1348
1349 versionfile_abs = os.path.join(root, cfg.versionfile_source)
1350
1351 # extract version from first of: _version.py, VCS command (e.g. 'git
1352 # describe'), parentdir. This is meant to work for developers using a
1353 # source checkout, for users of a tarball created by 'setup.py sdist',
1354 # and for users of a tarball/zipball created by 'git archive' or github's
1355 # download-from-tag feature or the equivalent in other VCSes.
1356
1357 get_keywords_f = handlers.get("get_keywords")
1358 from_keywords_f = handlers.get("keywords")
1359 if get_keywords_f and from_keywords_f:
1360 try:
1361 keywords = get_keywords_f(versionfile_abs)
1362 ver = from_keywords_f(keywords, cfg.tag_prefix, verbose)
1363 if verbose:
1364 print("got version from expanded keyword %s" % ver)
1365 return ver
1366 except NotThisMethod:
1367 pass
1368
1369 try:
1370 ver = versions_from_file(versionfile_abs)
1371 if verbose:
1372 print("got version from file %s %s" % (versionfile_abs, ver))
1373 return ver
1374 except NotThisMethod:
1375 pass
1376
1377 from_vcs_f = handlers.get("pieces_from_vcs")
1378 if from_vcs_f:
1379 try:
1380 pieces = from_vcs_f(cfg.tag_prefix, root, verbose)
1381 ver = render(pieces, cfg.style)
1382 if verbose:
1383 print("got version from VCS %s" % ver)
1384 return ver
1385 except NotThisMethod:
1386 pass
1387
1388 try:

Callers 5

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

Calls 7

get_rootFunction · 0.85
get_config_from_rootFunction · 0.85
versions_from_fileFunction · 0.85
joinMethod · 0.80
renderFunction · 0.70
versions_from_parentdirFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected