diff --git a/contrib/devtools/gen-manpages.py b/contrib/devtools/gen-manpages.py index 92acd9a403..71e595b258 100755 --- a/contrib/devtools/gen-manpages.py +++ b/contrib/devtools/gen-manpages.py @@ -57,19 +57,22 @@ if any(verstr.endswith('-dirty') for (_, verstr, _) in versions): print('To properly generate man pages, please commit your changes (or discard them), rebuild, then run this script again.') print() -with tempfile.NamedTemporaryFile('w', suffix='.h2m') as footer: +basename_binaries = tuple(s.rpartition('/')[2] for s in BINARIES) + +for (abspath, verstr, copyright) in versions: + with tempfile.NamedTemporaryFile('w', suffix='.h2m') as footer: # Create copyright footer, and write it to a temporary include file. # Copyright is the same for all binaries, so just use the first. footer.write('[COPYRIGHT]\n') footer.write('\n'.join(versions[0][2]).strip()) # Create SEE ALSO section footer.write('\n[SEE ALSO]\n') - footer.write(', '.join(s.rpartition('/')[2] + '(1)' for s in BINARIES)) + footer.write(', '.join(s + "(1)" for s in basename_binaries if not abspath.endswith("/" + s))) footer.write('\n') footer.flush() # Call the binaries through help2man to produce a manual page for each of them. - for (abspath, verstr, _) in versions: + if True: outname = os.path.join(mandir, os.path.basename(abspath) + '.1') print(f'Generating {outname}…') subprocess.run([help2man, '-N', '--version-string=' + verstr, '--include=' + footer.name, '-o', outname, abspath], check=True)