(filename, dirs=None)
| 247 | return "%s.ini" % pkg_name |
| 248 | |
| 249 | def 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 | |
| 285 | def _read_config_imp(filenames, dirs=None): |
| 286 | def _read_config(f): |
no test coverage detected