chiark / gitweb /
man: ignore non-manpage files when generating makefile
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 19 Feb 2014 21:06:10 +0000 (16:06 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 21 Feb 2014 03:43:27 +0000 (22:43 -0500)
tools/make-man-rules.py

index 0d1ca24..6224de3 100644 (file)
@@ -66,6 +66,8 @@ def xml(file):
 def add_rules(rules, name):
     xml = xml_parse(name)
     # print('parsing {}'.format(name), file=sys.stderr)
+    if xml.getroot().tag != 'refentry':
+        return
     conditional = xml.getroot().get('conditional') or ''
     rulegroup = rules[conditional]
     refmeta = xml.find('./refmeta')
@@ -86,7 +88,11 @@ def create_rules(xml_files):
     " {conditional => {alias-name => source-name}} "
     rules = collections.defaultdict(dict)
     for name in xml_files:
-        add_rules(rules, name)
+        try:
+            add_rules(rules, name)
+        except Exception:
+            print("Failed to process", name, file=sys.stderr)
+            raise
     return rules
 
 def mjoin(files):