MCPcopy Create free account
hub / github.com/microsoft/debugpy / get_config_from_root

Function get_config_from_root

versioneer.py:337–362  ·  view source on GitHub ↗

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

(root)

Source from the content-addressed store, hash-verified

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

VersioneerConfigClass · 0.70
joinMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…