summaryrefslogtreecommitdiff
path: root/make-man-rules.py
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-12-21 18:11:35 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-12-21 18:35:27 -0500
commit40be878abb86308f1aa025f5bbc77dff16383025 (patch)
tree2c28ae7e97b5fa0888b46fd5c1a0e96da3cb691f /make-man-rules.py
parent2dc38ed00fe5c9179721411ba068b53ea127d476 (diff)
build-sys: add xml sources to EXTRA_DIST
Apparently automake does not include the sources if they are under a conditional that is disabled when making dist. This means that everything would have to be enabled to make distcheck work.
Diffstat (limited to 'make-man-rules.py')
-rw-r--r--make-man-rules.py22
1 files changed, 17 insertions, 5 deletions
diff --git a/make-man-rules.py b/make-man-rules.py
index ad601f874f..0d1ca244c4 100644
--- a/make-man-rules.py
+++ b/make-man-rules.py
@@ -20,6 +20,7 @@
from __future__ import print_function
import collections
import sys
+import os.path
from xml_helper import *
SECTION = '''\
@@ -50,9 +51,18 @@ HTML_ALIAS_RULE = '''\
$(html-alias)
'''
+FOOTER = '''\
+
+EXTRA_DIST += \\
+ {files}
+'''
+
def man(page, number):
return 'man/{}.{}'.format(page, number)
+def xml(file):
+ return 'man/{}'.format(os.path.basename(file))
+
def add_rules(rules, name):
xml = xml_parse(name)
# print('parsing {}'.format(name), file=sys.stderr)
@@ -72,7 +82,7 @@ def add_rules(rules, name):
rulegroup[alias] = target
# print('{} => {} [{}]'.format(alias, target, conditional), file=sys.stderr)
-def create_rules(*xml_files):
+def create_rules(xml_files):
" {conditional => {alias-name => source-name}} "
rules = collections.defaultdict(dict)
for name in xml_files:
@@ -82,7 +92,7 @@ def create_rules(*xml_files):
def mjoin(files):
return ' \\\n\t'.join(sorted(files) or '#')
-def make_makefile(rules):
+def make_makefile(rules, files):
return HEADER + '\n'.join(
(CONDITIONAL if conditional else SECTION).format(
manpages=mjoin(set(rulegroup.values())),
@@ -94,8 +104,10 @@ def make_makefile(rules):
for k,v in sorted(rulegroup.items())
if k != v),
conditional=conditional)
- for conditional,rulegroup in sorted(rules.items()))
+ for conditional,rulegroup in sorted(rules.items())
+ ) + FOOTER.format(files=mjoin(sorted(files)))
if __name__ == '__main__':
- rules = create_rules(*sys.argv[1:])
- print(make_makefile(rules), end='')
+ rules = create_rules(sys.argv[1:])
+ files = (xml(file) for file in sys.argv[1:])
+ print(make_makefile(rules, files), end='')