diff options
Diffstat (limited to 'giscanner/girparser.py')
-rw-r--r-- | giscanner/girparser.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/giscanner/girparser.py b/giscanner/girparser.py index 40bc49e0..d258069a 100644 --- a/giscanner/girparser.py +++ b/giscanner/girparser.py @@ -24,6 +24,7 @@ from xml.etree.cElementTree import parse from . import ast from .girwriter import COMPATIBLE_GIR_VERSION +from .collections import OrderedDict CORE_NS = "http://www.gtk.org/introspection/core/1.0" C_NS = "http://www.gtk.org/introspection/c/1.0" @@ -165,9 +166,18 @@ class GIRParser(object): def _parse_generic_attribs(self, node, obj): assert isinstance(obj, ast.Annotated) + skip = node.attrib.get('skip') + if skip: + try: + obj.skip = int(skip) > 0 + except ValueError: + obj.skip = False introspectable = node.attrib.get('introspectable') if introspectable: - obj.introspectable = int(introspectable) > 0 + try: + obj.introspectable = int(introspectable) > 0 + except ValueError: + obj.introspectable = False if self._types_only: return doc = node.find(_corens('doc')) @@ -195,6 +205,14 @@ class GIRParser(object): if stability_doc is not None: if stability_doc.text: obj.stability_doc = stability_doc.text + attributes = node.findall(_corens('attribute')) + if attributes: + attributes_ = OrderedDict() + for attribute in attributes: + name = attribute.attrib.get('name') + value = attribute.attrib.get('value') + attributes_[name] = value + obj.attributes = attributes_ def _parse_object_interface(self, node): parent = node.attrib.get('parent') |