summaryrefslogtreecommitdiff
path: root/giscanner/xmlwriter.py
diff options
context:
space:
mode:
authorLucas Rocha <lucasr@gnome.org>2008-10-11 18:33:43 +0000
committerLucas Almeida Rocha <lucasr@src.gnome.org>2008-10-11 18:33:43 +0000
commit0be08ed820506a63b5a9342d52d695f977934145 (patch)
tree2955cbd94fba25494a18deedbf176a88e41a84a4 /giscanner/xmlwriter.py
parentf1be097d3be66639374c160225f01cfd42275953 (diff)
downloadgobject-introspection-0be08ed820506a63b5a9342d52d695f977934145.tar.gz
Bug 554854: The --typelib-xml and --inject options should reuse giscanner
2008-10-11 Lucas Rocha <lucasr@gnome.org> Bug 554854: The --typelib-xml and --inject options should reuse giscanner parser/writer. * giscanner/ast.py: add constructor list to Struct and Union. Add new param in Return's contructor to define transfer. * giscanner/girparser.py: several additions to the parser in order to have parsing all nodes of the gir xml files. * tools/g-ir-scanner (typelib_xml_strip, inject): use gir parser and writer in --inject and --typelib-xml options. * giscanner/xmlwriter.py: ignore empty attributes instead of raising an error as this basically exposes a bug in GIRParser. This should be reverted as soon as the parser is fixed. svn path=/trunk/; revision=665
Diffstat (limited to 'giscanner/xmlwriter.py')
-rw-r--r--giscanner/xmlwriter.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/giscanner/xmlwriter.py b/giscanner/xmlwriter.py
index eb17c619..5176499d 100644
--- a/giscanner/xmlwriter.py
+++ b/giscanner/xmlwriter.py
@@ -40,9 +40,12 @@ class XMLWriter(object):
return -1
attr_length = 0
for attr, value in attributes:
+ # FIXME: actually, if we have attributes with None as value this
+ # should be considered a bug and raise an error. We are just
+ # ignoring them here while we fix GIRParser to create the right
+ # ast with the correct attributes.
if value is None:
- raise ValueError(
- "value for attribute %r cannot be None" % (attr, ))
+ continue
attr_length += 2 + len(attr) + len(quoteattr(value))
return attr_length + indent + self._indent
@@ -56,11 +59,14 @@ class XMLWriter(object):
first = True
attr_value = ''
for attr, value in attributes:
+ # FIXME: actually, if we have attributes with None as value this
+ # should be considered a bug and raise an error. We are just
+ # ignoring them here while we fix GIRParser to create the right
+ # ast with the correct attributes.
+ if value is None:
+ continue
if indent_len and not first:
attr_value += '\n%s' % (self._indent_char * indent_len)
- if value is None:
- raise ValueError(
- "value for attribute %r cannot be None" % (attr, ))
attr_value += ' %s=%s' % (attr, quoteattr(value))
if first:
first = False