def get_config_from_root(root):
 setup_cfg = os.path.join(root, 'setup.cfg')
 parser = configparser.SafeConfigParser()
 with open(setup_cfg, 'r') as f:
  parser.readfp(f)
 VCS = parser.get('versioneer', 'VCS')
 def get(parser, name):
  if parser.has_option('versioneer', name):
   return parser.get('versioneer', name)
  return None
 cfg = VersioneerConfig()
 cfg.VCS = VCS
 cfg.style = (get(parser, 'style') or '')
 cfg.versionfile_source = get(parser, 'versionfile_source')
 cfg.versionfile_build = get(parser, 'versionfile_build')
 cfg.tag_prefix = get(parser, 'tag_prefix')
 if (cfg.tag_prefix in ("''", '""')):
  cfg.tag_prefix = ''
 cfg.parentdir_prefix = get(parser, 'parentdir_prefix')
 cfg.verbose = get(parser, 'verbose')
 return cfg

def get_config_from_root ( root ) : setup_cfg = os . path . join ( root , 'setup.cfg' ) parser = configparser . SafeConfigParser ( ) with open ( setup_cfg , 'r' ) as f : parser . readfp ( f ) VCS = parser . get ( 'versioneer' , 'VCS' ) def get ( parser , name ) : if parser . has_option ( 'versioneer' , name ) : return parser . get ( 'versioneer' , name ) return None cfg = VersioneerConfig ( ) cfg . VCS = VCS cfg . style = ( get ( parser , 'style' ) or '' ) cfg . versionfile_source = get ( parser , 'versionfile_source' ) cfg . versionfile_build = get ( parser , 'versionfile_build' ) cfg . tag_prefix = get ( parser , 'tag_prefix' ) if ( cfg . tag_prefix in ( "''" , '""' ) ) : cfg . tag_prefix = '' cfg . parentdir_prefix = get ( parser , 'parentdir_prefix' ) cfg . verbose = get ( parser , 'verbose' ) return cfg
read the project setup .