summaryrefslogtreecommitdiff
path: root/giscanner/girparser.py
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2009-02-05 17:36:35 -0500
committerColin Walters <walters@verbum.org>2009-02-11 15:03:16 -0500
commit44ea75378eb33fa6386e66e9e5a55f3122363fb8 (patch)
tree27385b5c523f7390193dba950df134540aabd838 /giscanner/girparser.py
parent1b5e689fe2fc105725fe71051c184e0f1c461223 (diff)
downloadgobject-introspection-44ea75378eb33fa6386e66e9e5a55f3122363fb8.tar.gz
Bug 567906 - Put pkg-config dependencies in .gir files
When generating a .gir file, we now first parse all of our .gir includes to pick up their <package> headers. Then, we merge that with the set of --pkg arguments passed to us, run pkg-config to gather the arguments, and finally save the merged pkg-config list to our new .gir file. This is useful for software which needs to map from .gir to pkg-config in a programmatic way.
Diffstat (limited to 'giscanner/girparser.py')
-rw-r--r--giscanner/girparser.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/giscanner/girparser.py b/giscanner/girparser.py
index 3e2432ed..62db3e98 100644
--- a/giscanner/girparser.py
+++ b/giscanner/girparser.py
@@ -50,6 +50,7 @@ class GIRParser(object):
self._include_parsing = False
self._shared_libraries = []
self._includes = set()
+ self._pkgconfig_packages = set()
self._namespace = None
# Public API
@@ -62,6 +63,7 @@ class GIRParser(object):
self._includes.clear()
self._namespace = None
self._shared_libraries = []
+ self._pkgconfig_packages = set()
self._parse_api(tree.getroot())
def get_namespace(self):
@@ -73,6 +75,9 @@ class GIRParser(object):
def get_includes(self):
return self._includes
+ def get_pkgconfig_packages(self):
+ return self._pkgconfig_packages
+
def get_doc(self):
return parse(self._filename)
@@ -89,6 +94,8 @@ class GIRParser(object):
for node in root.getchildren():
if node.tag == _corens('include'):
self._parse_include(node)
+ elif node.tag == _corens('package'):
+ self._parse_pkgconfig_package(node)
ns = root.find(_corens('namespace'))
assert ns is not None
@@ -122,6 +129,9 @@ class GIRParser(object):
node.attrib['version'])
self._includes.add(include)
+ def _parse_pkgconfig_package(self, node):
+ self._pkgconfig_packages.add(node.attrib['name'])
+
def _parse_alias(self, node):
alias = Alias(node.attrib['name'],
node.attrib['target'],