summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README1
-rwxr-xr-xmake-directive-index.py9
-rwxr-xr-xmake-man-index.py9
3 files changed, 15 insertions, 4 deletions
diff --git a/README b/README
index 9d7a54769d..b8d1f42e25 100644
--- a/README
+++ b/README
@@ -116,6 +116,7 @@ REQUIREMENTS:
gtkdocize (optional)
python (optional)
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/make-directive-index.py b/make-directive-index.py
index c61383b0a4..039efaa434 100755
--- a/make-directive-index.py
+++ b/make-directive-index.py
@@ -19,7 +19,12 @@
import sys
import collections
-import xml.etree.ElementTree as tree
+try:
+ from lxml import etree as tree
+ PRETTY = dict(pretty_print=True)
+except ImportError:
+ import xml.etree.ElementTree as tree
+ PRETTY = {}
import re
TEMPLATE = '''\
@@ -277,4 +282,4 @@ def make_page(*xml_files):
return _make_page(template, directive_groups, formatting)
if __name__ == '__main__':
- tree.dump(make_page(*sys.argv[1:]))
+ tree.dump(make_page(*sys.argv[1:]), **PRETTY)
diff --git a/make-man-index.py b/make-man-index.py
index d38d5b63f6..d9ab5cc752 100755
--- a/make-man-index.py
+++ b/make-man-index.py
@@ -19,7 +19,12 @@
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
import collections
-import xml.etree.ElementTree as tree
+try:
+ from lxml import etree as tree
+ PRETTY = dict(pretty_print=True)
+except ImportError:
+ import xml.etree.ElementTree as tree
+ PRETTY = {}
import sys
import re
MDASH = ' — ' if sys.version_info.major >= 3 else ' -- '
@@ -130,4 +135,4 @@ def make_page(xml_files):
return template
if __name__ == '__main__':
- tree.dump(make_page(sys.argv[1:]))
+ tree.dump(make_page(sys.argv[1:]), **PRETTY)