def parse(packages, static=False):
for package in packages.split():<EOL><INDENT>_raise_if_not_exists(package)<EOL><DEDENT>out = _query(packages, *_build_options('<STR_LIT>', static=static))<EOL>out = out.replace('<STR_LIT>', '<STR_LIT>')<EOL>result = collections.defaultdict(list)<EOL>for token in re.split(r'<STR_LIT>', out):<EOL><INDENT>key = _PARSE_MAP.get(token[:<NUM_LIT:2>])<EOL>if key:<EOL><INDENT>result[key].append(token[<NUM_LIT:2>:].strip())<EOL><DEDENT><DEDENT>def split(m):<EOL><INDENT>t = tuple(m.split('<STR_LIT:=>'))<EOL>return t if len(t) > <NUM_LIT:1> else (t[<NUM_LIT:0>], None)<EOL><DEDENT>result['<STR_LIT>'] = [split(m) for m in result['<STR_LIT>']]<EOL>return collections.defaultdict(list, ((k, v) for k, v in result.items() if v))<EOL>
Parse the output from pkg-config about the passed package or packages.

Builds a dictionary containing the 'libraries', the 'library_dirs', the
'include_dirs', and the 'define_macros' that are presented by pkg-config.
*package* is a string with space-delimited package names.

The static specifier will also include libraries for static linking (i.e.,
includes any private libraries).

If ``pkg-config`` is not on path, raises ``EnvironmentError``.