1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

build-sys: drop support for generation of Makefile-man.am

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2017-07-02 20:22:35 -04:00
parent 72cdb3e783
commit 0689f766dc
2 changed files with 5 additions and 68 deletions

View File

@ -198,7 +198,7 @@ if git.found()
# and https://github.com/mesonbuild/meson/issues/1512
command : ['sh', '-c',
'cd @0@ && '.format(meson.build_root()) +
'python3 @0@/tools/make-man-rules.py --meson `git ls-files ":/man/*.xml"` >t && '.format(meson.source_root()) +
'python3 @0@/tools/make-man-rules.py `git ls-files ":/man/*.xml"` >t && '.format(meson.source_root()) +
'mv t @0@/rules/meson.build'.format(meson.current_source_dir())],
depend_files : custom_entities_ent)
endif

View File

@ -25,55 +25,11 @@ import os.path
import pprint
from xml_helper import *
SECTION = '''\
MANPAGES += \\
{manpages}
MANPAGES_ALIAS += \\
{aliases}
{rules}
{htmlrules}
'''
CONDITIONAL = '''\
if {conditional}
''' \
+ SECTION + \
'''\
endif
'''
HEADER = '''\
# Do not edit. Generated by make-man-rules.py.
# To regenerate:
# 1. Create, update, or remove source .xml files in man/
# 2. Run 'make update-man-list'
# 3. Run 'make man' to generate manpages
#
# To make a man page conditional on a configure switch add
# attribute conditional="ENABLE_WHAT" or conditional="WITH_WHAT"
# to <refentry> element.
'''
HTML_ALIAS_RULE = '''\
{}.html: {}.html
$(html-alias)
'''
FOOTER = '''\
# Really, do not edit this file.
EXTRA_DIST += \\
{dist_files}
'''
meson = False
def man(page, number):
return ('man/' if not meson else '') + '{}.{}'.format(page, number)
return '{}.{}'.format(page, number)
def xml(file):
return ('man/' if not meson else '') + os.path.basename(file)
return os.path.basename(file)
def add_rules(rules, name):
xml = xml_parse(name)
@ -110,21 +66,6 @@ def create_rules(xml_files):
def mjoin(files):
return ' \\\n\t'.join(sorted(files) or '#')
def make_makefile(rules, dist_files):
return HEADER + '\n'.join(
(CONDITIONAL if conditional else SECTION).format(
manpages=mjoin(set(rulegroup.values())),
aliases=mjoin(k for k,v in rulegroup.items() if k != v),
rules='\n'.join('{}: {}'.format(k,v)
for k,v in sorted(rulegroup.items())
if k != v),
htmlrules='\n'.join(HTML_ALIAS_RULE.format(k[:-2],v[:-2])
for k,v in sorted(rulegroup.items())
if k != v),
conditional=conditional)
for conditional,rulegroup in sorted(rules.items())
) + FOOTER.format(dist_files=mjoin(sorted(dist_files)))
MESON_HEADER = '''\
# Do not edit. Generated by make-man-rules.py.
manpages = ['''
@ -151,14 +92,10 @@ def make_mesonfile(rules, dist_files):
return '\n'.join((MESON_HEADER, pprint.pformat(lines)[1:-1], MESON_FOOTER))
if __name__ == '__main__':
meson = sys.argv[1] == '--meson'
pages = sys.argv[1+meson:]
pages = sys.argv[1:]
rules = create_rules(pages)
dist_files = (xml(file) for file in pages
if not file.endswith(".directives.xml") and
not file.endswith(".index.xml"))
if meson:
print(make_mesonfile(rules, dist_files))
else:
print(make_makefile(rules, dist_files), end='')
print(make_mesonfile(rules, dist_files))