extract_swift_flags: Remove 'docbook' command
We don't support Docbook anymore and this didn't work due to missing templates. Kill the subcommand. Change-Id: I38514946a48804c0eb50614ea31553e2b01135ac
This commit is contained in:
parent
e71cc262c9
commit
80d376e08e
|
@ -36,28 +36,6 @@ from autohelp import OptionsCache # noqa
|
||||||
|
|
||||||
DBK_NS = ".//{http://docbook.org/ns/docbook}"
|
DBK_NS = ".//{http://docbook.org/ns/docbook}"
|
||||||
|
|
||||||
BASE_XML = '''<?xml version="1.0"?>
|
|
||||||
<para xmlns="http://docbook.org/ns/docbook"
|
|
||||||
version="5.0">
|
|
||||||
<!-- The tool that generated this table lives in the
|
|
||||||
openstack-doc-tools repository. The editions made in
|
|
||||||
this file will *not* be lost if you run the script again. -->
|
|
||||||
<table rules="all">
|
|
||||||
<caption>Description of configuration options for
|
|
||||||
<literal>[%s]</literal> in <filename>%s.conf</filename>
|
|
||||||
</caption>
|
|
||||||
<col width="50%%"/>
|
|
||||||
<col width="50%%"/>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Configuration option = Default value</th>
|
|
||||||
<th>Description</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody></tbody>
|
|
||||||
</table>
|
|
||||||
</para>'''
|
|
||||||
|
|
||||||
|
|
||||||
def parse_line(line):
|
def parse_line(line):
|
||||||
"""Parse a line.
|
"""Parse a line.
|
||||||
|
@ -169,10 +147,10 @@ def extract_descriptions_from_devref(swift_repo, options):
|
||||||
return option_descs
|
return option_descs
|
||||||
|
|
||||||
|
|
||||||
def write_files(options, manuals_repo, output_format):
|
def write_files(options, manuals_repo):
|
||||||
"""Create new DocBook tables.
|
"""Create new reStructuredText tables.
|
||||||
|
|
||||||
Writes a set of DocBook-formatted tables, one per section in swift
|
Writes a set of reStructuredText-formatted tables, one per section in swift
|
||||||
configuration files.
|
configuration files.
|
||||||
"""
|
"""
|
||||||
all_options = {}
|
all_options = {}
|
||||||
|
@ -191,19 +169,15 @@ def write_files(options, manuals_repo, output_format):
|
||||||
for full_section, options in all_options.items():
|
for full_section, options in all_options.items():
|
||||||
sample_filename, section = full_section.split('|')
|
sample_filename, section = full_section.split('|')
|
||||||
tmpl_file = os.path.join(os.path.dirname(__file__),
|
tmpl_file = os.path.join(os.path.dirname(__file__),
|
||||||
'templates/swift.%s.j2' % output_format)
|
'templates/swift.rst.j2')
|
||||||
with open(tmpl_file) as fd:
|
with open(tmpl_file) as fd:
|
||||||
template = jinja2.Template(fd.read(), trim_blocks=True)
|
template = jinja2.Template(fd.read(), trim_blocks=True)
|
||||||
output = template.render(filename=sample_filename,
|
output = template.render(filename=sample_filename,
|
||||||
section=section,
|
section=section,
|
||||||
options=options)
|
options=options)
|
||||||
|
|
||||||
if output_format == 'docbook':
|
tgt = (manuals_repo + '/doc/config-reference/source/tables/' +
|
||||||
tgt = (manuals_repo + '/doc/common/tables/' + 'swift-' +
|
'swift-' + sample_filename + '-' + section + '.rst')
|
||||||
sample_filename + '-' + section + '.xml')
|
|
||||||
else:
|
|
||||||
tgt = (manuals_repo + '/doc/config-reference/source/tables/' +
|
|
||||||
'swift-' + sample_filename + '-' + section + '.rst')
|
|
||||||
|
|
||||||
with open(tgt, 'w') as fd:
|
with open(tgt, 'w') as fd:
|
||||||
fd.write(output)
|
fd.write(output)
|
||||||
|
@ -289,11 +263,11 @@ def main():
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description="Update the swift options tables.",
|
description="Update the swift options tables.",
|
||||||
usage=("%(prog)s docbook|rst|dump [-v] [-s swift_repo] "
|
usage=("%(prog)s rst|dump [-v] [-s swift_repo] "
|
||||||
"[-m manuals_repo]"))
|
"[-m manuals_repo]"))
|
||||||
parser.add_argument('subcommand',
|
parser.add_argument('subcommand',
|
||||||
help='Action (docbook, rst, dump).',
|
help='Action (rst, dump).',
|
||||||
choices=['docbook', 'dump', 'rst'])
|
choices=['dump', 'rst'])
|
||||||
parser.add_argument('-s', '--swift-repo',
|
parser.add_argument('-s', '--swift-repo',
|
||||||
dest='swift_repo',
|
dest='swift_repo',
|
||||||
help="Location of the swift git repository.",
|
help="Location of the swift git repository.",
|
||||||
|
@ -327,10 +301,9 @@ def main():
|
||||||
args.verbose)
|
args.verbose)
|
||||||
options = OptionsCache()
|
options = OptionsCache()
|
||||||
|
|
||||||
if args.subcommand in ('docbook', 'rst'):
|
if args.subcommand == 'rst':
|
||||||
write_files(options, args.manuals_repo, args.subcommand)
|
write_files(options, args.manuals_repo)
|
||||||
|
else:
|
||||||
elif args.subcommand == 'dump':
|
|
||||||
options.dump()
|
options.dump()
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
---
|
||||||
|
upgrade:
|
||||||
|
- |
|
||||||
|
The `extract_swift_flags` tool no longer supports the `docbook` command.
|
||||||
|
This previously allowed outputting of Docbook-formatted text but the
|
||||||
|
feature was broken and unsupported by the community. reStructuredText
|
||||||
|
should be used for everything.
|
Loading…
Reference in New Issue