MCPcopy Create free account
hub / github.com/numpy/numpy / parse_config

Function parse_config

numpy/distutils/npy_pkg_config.py:249–283  ·  view source on GitHub ↗
(filename, dirs=None)

Source from the content-addressed store, hash-verified

247 return "%s.ini" % pkg_name
248
249def parse_config(filename, dirs=None):
250 if dirs:
251 filenames = [os.path.join(d, filename) for d in dirs]
252 else:
253 filenames = [filename]
254
255 config = RawConfigParser()
256
257 n = config.read(filenames)
258 if not len(n) >= 1:
259 raise PkgNotFound("Could not find file(s) %s" % str(filenames))
260
261 # Parse meta and variables sections
262 meta = parse_meta(config)
263
264 vars = {}
265 if config.has_section('variables'):
266 for name, value in config.items("variables"):
267 vars[name] = _escape_backslash(value)
268
269 # Parse "normal" sections
270 secs = [s for s in config.sections() if not s in ['meta', 'variables']]
271 sections = {}
272
273 requires = {}
274 for s in secs:
275 d = {}
276 if config.has_option(s, "requires"):
277 requires[s] = config.get(s, 'requires')
278
279 for name, value in config.items(s):
280 d[name] = value
281 sections[s] = d
282
283 return meta, vars, sections, requires
284
285def _read_config_imp(filenames, dirs=None):
286 def _read_config(f):

Callers 1

_read_configFunction · 0.85

Calls 7

PkgNotFoundClass · 0.85
parse_metaFunction · 0.85
_escape_backslashFunction · 0.85
sectionsMethod · 0.80
joinMethod · 0.45
readMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected