[systemd-commits] 2 commits - configure.ac Makefile.am README tools/xml_helper.py

Zbigniew Jędrzejewski-Szmek zbyszek at kemper.freedesktop.org
Wed Feb 12 00:05:11 PST 2014


 Makefile.am         |    3 ++-
 README              |    2 +-
 configure.ac        |    4 +++-
 tools/xml_helper.py |   27 ++++++++-------------------
 4 files changed, 14 insertions(+), 22 deletions(-)

New commits:
commit 32dcef3ab1eb91ee469c3246ef859578dccd8a45
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Wed Feb 12 02:58:41 2014 -0500

    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.

diff --git a/README b/README
index 509b45f..9aa6312 100644
--- a/README
+++ b/README
@@ -133,8 +133,8 @@ REQUIREMENTS:
         gperf
         gtkdocize (optional)
         python (optional)
+        python-lxml (optional, but required to build the indices)
         sphinx (optional)
-        python-lxml (entirely optional)
 
         When systemd-hostnamed is used, it is strongly recommended to
         install nss-myhostname to ensure that, in a world of
diff --git a/configure.ac b/configure.ac
index d92f1fe..59650a2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -188,9 +188,11 @@ have_python=no
 AC_ARG_WITH([python],
         [AS_HELP_STRING([--without-python], [Disable building the man page index and systemd-python (default: test)])])
 
+have_lxml=no
 AS_IF([test "x$with_python" != "xno"], [
         AM_PATH_PYTHON(,, [:])
-        AS_IF([test "$PYTHON" != :], [have_python=yes])
+        AS_IF(["$PYTHON" -c 'import lxml' 2>/dev/null], [have_lxml=yes], [have_lxml=no])
+        AS_IF([test "$PYTHON" != : -a $have_lxml = yes], [have_python=yes])
 ])
 AM_CONDITIONAL([HAVE_PYTHON], [test "x$have_python" = "xyes"])
 AS_IF([test "x$PYTHON_BINARY" = "x"],
diff --git a/tools/xml_helper.py b/tools/xml_helper.py
index 0d91a17..e87126f 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')

commit feef0842cfa8abe8b76c16e026217bad7e90f283
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Wed Feb 12 02:05:06 2014 -0500

    build-sys: add less-variables.xml to EXTRA_DIST

diff --git a/Makefile.am b/Makefile.am
index 09547d3..da25b1d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -644,7 +644,8 @@ EXTRA_DIST += \
 	tools/make-man-index.py \
 	tools/make-directive-index.py \
 	tools/make-man-rules.py \
-	tools/xml_helper.py
+	tools/xml_helper.py \
+	man/less-variables.xml
 
 # ------------------------------------------------------------------------------
 noinst_LTLIBRARIES += \



More information about the systemd-commits mailing list