GNOME Bugzilla – Bug 738171
(skip) annotation on a parameter causes GI build failure
Last modified: 2015-03-04 20:04:23 UTC
I wanted to try out using (skip) on parameter names, using the makefile rule to build GLib-2.0.gir out of gir/glib-2.0.c in the gobject-introspection tree. This appears to be unsupported by the Python GIR scanner, which breaks the build: ERROR: Failed to re-parse gir file; scanned='/tmp/tmpG3uu_B.gir' passthrough='/tmp/tmpcUH5t9.gir' The passthrough file lacks skip="1" attribute on the parameter element.
Yeah. The same happens annotating return values with (skip).
Created attachment 292221 [details] [review] giscanner: fix GIRParser skip handling The skip annotation on symbols ends up as an introspectable xml attribute but on paramters and the return value a skip attribute is written. Making GIRParser read the skip attribute fixes g-ir-scanner's passthrough gir test for skipped attributes and/or return values.
Created attachment 292455 [details] [review] giscanner: enable the --reparse-validate option for our test suite 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
Review of attachment 292455 [details] [review]: Just my 2 cents. ::: giscanner/girparser.py @@ +169,3 @@ + skip = node.attrib.get('skip') + if skip: + obj.skip = int(skip) > 0 You may want to catch ValueError here, which will be raised for empty strings or non-numbers. @@ +202,3 @@ + attributes = node.findall(_corens('attribute')) + if attributes: + _attributes = OrderedDict() nitpick, trailing underscores (eg attributes_) is more common for things that conflict. A leading underscore (eg, _attributes) implies that it is private or hidden.
Created attachment 292636 [details] [review] giscanner: enable the --reparse-validate option for our test suite Thanks for the review! Fixes both issues mentioned above.
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]
Thanks for the review. Attachment #292636 [details] pushed as 5a137d0, including fixes for the nitpicks mentioned in comment #4.