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

Function get_config_from_root

versioneer.py:393–416  ·  view source on GitHub ↗
(root)

Source from the content-addressed store, hash-verified

391
392
393def get_config_from_root(root):
394 # This might raise EnvironmentError (if setup.cfg is missing), or
395 # configparser.NoSectionError (if it lacks a [versioneer] section), or
396 # configparser.NoOptionError (if it lacks "VCS="). See the docstring at
397 # the top of versioneer.py for instructions on writing your setup.cfg .
398 setup_cfg = os.path.join(root, "setup.cfg")
399 parser = configparser.SafeConfigParser()
400 with open(setup_cfg, "r") as f:
401 parser.readfp(f)
402 VCS = parser.get("versioneer", "VCS") # mandatory
403
404 def get(parser, name):
405 if parser.has_option("versioneer", name):
406 return parser.get("versioneer", name)
407 return None
408 cfg = VersioneerConfig()
409 cfg.VCS = VCS
410 cfg.style = get(parser, "style") or ""
411 cfg.versionfile_source = get(parser, "versionfile_source")
412 cfg.versionfile_build = get(parser, "versionfile_build")
413 cfg.tag_prefix = get(parser, "tag_prefix")
414 cfg.parentdir_prefix = get(parser, "parentdir_prefix")
415 cfg.verbose = get(parser, "verbose")
416 return cfg
417
418
419class NotThisMethod(Exception):

Callers 5

get_versionsFunction · 0.85
runMethod · 0.85
runMethod · 0.85
make_release_treeMethod · 0.85
do_setupFunction · 0.85

Calls 4

getFunction · 0.85
joinMethod · 0.80
VersioneerConfigClass · 0.70
getMethod · 0.45

Tested by

no test coverage detected