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

Function _read_config_imp

numpy/distutils/npy_pkg_config.py:285–319  ·  view source on GitHub ↗
(filenames, dirs=None)

Source from the content-addressed store, hash-verified

283 return meta, vars, sections, requires
284
285def _read_config_imp(filenames, dirs=None):
286 def _read_config(f):
287 meta, vars, sections, reqs = parse_config(f, dirs)
288 # recursively add sections and variables of required libraries
289 for rname, rvalue in reqs.items():
290 nmeta, nvars, nsections, nreqs = _read_config(pkg_to_filename(rvalue))
291
292 # Update var dict for variables not in 'top' config file
293 for k, v in nvars.items():
294 if not k in vars:
295 vars[k] = v
296
297 # Update sec dict
298 for oname, ovalue in nsections[rname].items():
299 if ovalue:
300 sections[rname][oname] += ' %s' % ovalue
301
302 return meta, vars, sections, reqs
303
304 meta, vars, sections, reqs = _read_config(filenames)
305
306 # FIXME: document this. If pkgname is defined in the variables section, and
307 # there is no pkgdir variable defined, pkgdir is automatically defined to
308 # the path of pkgname. This requires the package to be imported to work
309 if not 'pkgdir' in vars and "pkgname" in vars:
310 pkgname = vars["pkgname"]
311 if not pkgname in sys.modules:
312 raise ValueError("You should import %s to get information on %s" %
313 (pkgname, meta["name"]))
314
315 mod = sys.modules[pkgname]
316 vars["pkgdir"] = _escape_backslash(os.path.dirname(mod.__file__))
317
318 return LibraryInfo(name=meta["name"], description=meta["description"],
319 version=meta["version"], sections=sections, vars=VariableSet(vars))
320
321# Trivial cache to cache LibraryInfo instances creation. To be really
322# efficient, the cache should be handled in read_config, since a same file can

Callers 1

read_configFunction · 0.85

Calls 4

_read_configFunction · 0.85
_escape_backslashFunction · 0.85
LibraryInfoClass · 0.85
VariableSetClass · 0.85

Tested by

no test coverage detected