summaryrefslogtreecommitdiff
path: root/giscanner/xmlwriter.py
diff options
context:
space:
mode:
Diffstat (limited to 'giscanner/xmlwriter.py')
-rwxr-xr-xgiscanner/xmlwriter.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/giscanner/xmlwriter.py b/giscanner/xmlwriter.py
index 4a1dc9fb..6efe684d 100755
--- a/giscanner/xmlwriter.py
+++ b/giscanner/xmlwriter.py
@@ -44,8 +44,7 @@ def _calc_attrs_length(attributes, indent, self_indent):
return attr_length + indent + self_indent
-def collect_attributes(tag_name, attributes, self_indent,
- self_indent_char, indent=-1):
+def collect_attributes(tag_name, attributes, self_indent, self_indent_char, indent=-1):
if not attributes:
return ''
if _calc_attrs_length(attributes, indent, self_indent) > 79:
@@ -68,6 +67,7 @@ def collect_attributes(tag_name, attributes, self_indent,
first = False
return attr_value
+
def build_xml_tag(tag_name, attributes=None, data=None, self_indent=0,
self_indent_char=' '):
if attributes is None:
@@ -86,6 +86,7 @@ def build_xml_tag(tag_name, attributes=None, data=None, self_indent=0,
len(prefix) + len(suffix))
return prefix + attrs + suffix
+
with LibtoolImporter(None, None):
if 'UNINSTALLED_INTROSPECTION_SRCDIR' in os.environ:
from _giscanner import collect_attributes
@@ -108,10 +109,8 @@ class XMLWriter(object):
def _open_tag(self, tag_name, attributes=None):
if attributes is None:
attributes = []
- attrs = collect_attributes(
- tag_name, attributes, self._indent,
- self._indent_char,
- len(tag_name) + 2)
+ attrs = collect_attributes(tag_name, attributes,
+ self._indent, self._indent_char, len(tag_name) + 2)
self.write_line(u'<%s%s>' % (tag_name, attrs))
def _close_tag(self, tag_name):
@@ -137,10 +136,9 @@ class XMLWriter(object):
if do_escape:
line = escape(line)
if indent:
- self._data.write('%s%s%s' % (
- self._indent_char * self._indent,
- line.encode('utf-8'),
- self._newline_char))
+ self._data.write('%s%s%s' % (self._indent_char * self._indent,
+ line.encode('utf-8'),
+ self._newline_char))
else:
self._data.write('%s%s' % (line.encode('utf-8'), self._newline_char))