diff options
author | Jack Lloyd <[email protected]> | 2018-01-21 12:49:15 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-01-21 12:49:15 -0500 |
commit | 65f375348c0773af6e9bbe3a005aef177dfd4ac3 (patch) | |
tree | 138fb3bb7995a282f4ebfd8033a0f53ceb4872fe | |
parent | 66d6ee2761e5152f9777b90dccdb569ce5156001 (diff) |
Fix headers of command line docs
Sphinx and rst2man want slightly different things, so just edit the
Sphinx-formatted ReST into a file in build dir
Fixes #1398
-rwxr-xr-x | configure.py | 32 | ||||
-rw-r--r-- | doc/manual/cli.rst | 5 | ||||
-rwxr-xr-x | src/scripts/build_docs.py | 3 |
3 files changed, 30 insertions, 10 deletions
diff --git a/configure.py b/configure.py index d1b6a9307..9d7cf364b 100755 --- a/configure.py +++ b/configure.py @@ -2830,10 +2830,8 @@ def calculate_cc_min_version(options, ccinfo, source_paths): logging.info('Auto-detected compiler version %s' % (cc_version)) return cc_version -def do_io_for_build(cc, arch, osinfo, - using_mods, build_paths, template_vars, - source_paths, options): - # pylint: disable=too-many-locals +def do_io_for_build(cc, arch, osinfo, using_mods, build_paths, source_paths, template_vars, options): + # pylint: disable=too-many-locals,too-many-branches try: robust_rmtree(build_paths.build_dir) @@ -2909,6 +2907,30 @@ def do_io_for_build(cc, arch, osinfo, makefile_template = os.path.join(source_paths.build_data_dir, 'makefile.in') write_template(template_vars['makefile_path'], makefile_template) + if options.with_rst2man: + rst2man_file = os.path.join(build_paths.build_dir, 'botan.rst') + cli_doc = os.path.join(source_paths.doc_dir, 'manual/cli.rst') + + cli_doc_contents = open(cli_doc).readlines() + + while cli_doc_contents[0] != "\n": + cli_doc_contents.pop(0) + + rst2man_header = """ +botan +============================= + +:Subtitle: Botan command line util +:Manual section: 1 + + """.strip() + + with open(rst2man_file, 'w') as f: + f.write(rst2man_header) + f.write("\n") + for line in cli_doc_contents: + f.write(line) + logging.info('Botan %s (revision %s) (%s %s) build setup is complete' % ( Version.as_string(), Version.vc_rev(), @@ -2996,7 +3018,7 @@ def main(argv): template_vars = create_template_vars(source_paths, build_paths, options, using_mods, cc, arch, osinfo) # Now we start writing to disk - do_io_for_build(cc, arch, osinfo, using_mods, build_paths, template_vars, source_paths, options) + do_io_for_build(cc, arch, osinfo, using_mods, build_paths, source_paths, template_vars, options) return 0 diff --git a/doc/manual/cli.rst b/doc/manual/cli.rst index 69b6d454e..47641aa3b 100644 --- a/doc/manual/cli.rst +++ b/doc/manual/cli.rst @@ -1,9 +1,6 @@ -botan +Command Line Interface ======================================== -:Subtitle: Botan command line util -:Manual section: 1 - Outline ------------ diff --git a/src/scripts/build_docs.py b/src/scripts/build_docs.py index 1787016e0..da36b5348 100755 --- a/src/scripts/build_docs.py +++ b/src/scripts/build_docs.py @@ -158,7 +158,8 @@ def main(args=None): cmds.append(['cp', manual_src, manual_output]) if with_rst2man: - cmds.append(['rst2man', os.path.join(manual_src, 'cli.rst'), + cmds.append(['rst2man', + os.path.join(cfg['build_dir'], 'botan.rst'), os.path.join(cfg['build_dir'], 'botan.1')]) cmds.append(['touch', doc_stamp_file]) |