From 32dcef3ab1eb91ee469c3246ef859578dccd8a45 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Wed, 12 Feb 2014 02:58:41 -0500 Subject: build-sys: make lxml required when generating indices Since the manpage indices generated without lxml would be missing some parts, it doesn't make sense to keep lxml optional anymore. --- tools/xml_helper.py | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) (limited to 'tools') diff --git a/tools/xml_helper.py b/tools/xml_helper.py index 0d91a17bbc..e87126f2f7 100644 --- a/tools/xml_helper.py +++ b/tools/xml_helper.py @@ -24,22 +24,11 @@ class CustomResolver(tree.Resolver): if 'custom-entities.ent' in url: return self.resolve_filename('man/custom-entities.ent', context) -try: - _parser = tree.XMLParser() - _parser.resolvers.add(CustomResolver()) - def xml_parse(page): - doc = tree.parse(page, _parser) - doc.xinclude() - return doc - def xml_print(xml): - return tree.tostring(xml, pretty_print=True, encoding='utf-8') - -except ImportError: - import xml.etree.ElementTree as tree - import re as _re - import io as _io - - def xml_parse(page): - s = _re.sub(b'&[a-zA-Z0-9_]+;', b'', open(page, 'rb').read()) - return tree.parse(_io.BytesIO(s)) - xml_print = lambda xml: tree.tostring(xml, encoding='utf-8') +_parser = tree.XMLParser() +_parser.resolvers.add(CustomResolver()) +def xml_parse(page): + doc = tree.parse(page, _parser) + doc.xinclude() + return doc +def xml_print(xml): + return tree.tostring(xml, pretty_print=True, encoding='utf-8') -- cgit v1.2.3-54-g00ecf