[gobject-introspection] giscanner: enable the --reparse-validate option for our test suite
- From: Dieter Verfaillie <dieterv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] giscanner: enable the --reparse-validate option for our test suite
- Date: Wed, 4 Mar 2015 20:02:35 +0000 (UTC)
commit 5a137d0b1a14f5bab6a09cbec8471557679d72f8
Author: Dieter Verfaillie <dieterv optionexplicit be>
Date: Mon Dec 8 20:11:44 2014 +0100
giscanner: enable the --reparse-validate option for our test suite
Doing so reveals GIRParser did not yet support:
- the (skip) annotation on parameters and return values
- the (attributes) annotation
This patch fixes both issues an prevents further similar problems.
https://bugzilla.gnome.org/show_bug.cgi?id=738171
giscanner/girparser.py | 20 +++++++++++++++++++-
tests/scanner/Makefile.am | 2 +-
2 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/giscanner/girparser.py b/giscanner/girparser.py
index 40bc49e..d258069 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')
diff --git a/tests/scanner/Makefile.am b/tests/scanner/Makefile.am
index 92ab12a..c7a1b32 100644
--- a/tests/scanner/Makefile.am
+++ b/tests/scanner/Makefile.am
@@ -5,7 +5,7 @@ include $(top_srcdir)/Makefile.introspection
SUBDIRS = . annotationparser
-INTROSPECTION_SCANNER_ARGS += --warn-all
+INTROSPECTION_SCANNER_ARGS += --warn-all --reparse-validate
CLEANFILES =
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]