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

Function get_config_from_root

versioneer.py:338–363  ·  view source on GitHub ↗

Read the project setup.cfg file to determine Versioneer config.

(root)

Source from the content-addressed store, hash-verified

336
337
338def get_config_from_root(root):
339 """Read the project setup.cfg file to determine Versioneer config."""
340 # This might raise OSError (if setup.cfg is missing), or
341 # configparser.NoSectionError (if it lacks a [versioneer] section), or
342 # configparser.NoOptionError (if it lacks "VCS="). See the docstring at
343 # the top of versioneer.py for instructions on writing your setup.cfg .
344 setup_cfg = os.path.join(root, "setup.cfg")
345 parser = configparser.ConfigParser()
346 with open(setup_cfg, "r") as cfg_file:
347 parser.read_file(cfg_file)
348 VCS = parser.get("versioneer", "VCS") # mandatory
349
350 # Dict-like interface for non-mandatory entries
351 section = parser["versioneer"]
352
353 cfg = VersioneerConfig()
354 cfg.VCS = VCS
355 cfg.style = section.get("style", "")
356 cfg.versionfile_source = section.get("versionfile_source")
357 cfg.versionfile_build = section.get("versionfile_build")
358 cfg.tag_prefix = section.get("tag_prefix")
359 if cfg.tag_prefix in ("''", '""', None):
360 cfg.tag_prefix = ""
361 cfg.parentdir_prefix = section.get("parentdir_prefix")
362 cfg.verbose = section.get("verbose")
363 return cfg
364
365
366class NotThisMethod(Exception):

Callers 8

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

Calls 2

getMethod · 0.95
VersioneerConfigClass · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…