Skip to content

Commit 902b4a8

Browse files
committed
contrib: manpages shouldn't "see also" themselves
1 parent 1248d0d commit 902b4a8

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

contrib/devtools/gen-manpages.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,22 @@
5757
print('To properly generate man pages, please commit your changes (or discard them), rebuild, then run this script again.')
5858
print()
5959

60-
with tempfile.NamedTemporaryFile('w', suffix='.h2m') as footer:
60+
basename_binaries = tuple(s.rpartition('/')[2] for s in BINARIES)
61+
62+
for (abspath, verstr, copyright) in versions:
63+
with tempfile.NamedTemporaryFile('w', suffix='.h2m') as footer:
6164
# Create copyright footer, and write it to a temporary include file.
6265
# Copyright is the same for all binaries, so just use the first.
6366
footer.write('[COPYRIGHT]\n')
6467
footer.write('\n'.join(versions[0][2]).strip())
6568
# Create SEE ALSO section
6669
footer.write('\n[SEE ALSO]\n')
67-
footer.write(', '.join(s.rpartition('/')[2] + '(1)' for s in BINARIES))
70+
footer.write(', '.join(s + "(1)" for s in basename_binaries if not abspath.endswith("/" + s)))
6871
footer.write('\n')
6972
footer.flush()
7073

7174
# Call the binaries through help2man to produce a manual page for each of them.
72-
for (abspath, verstr, _) in versions:
75+
if True:
7376
outname = os.path.join(mandir, os.path.basename(abspath) + '.1')
7477
print(f'Generating {outname}…')
7578
subprocess.run([help2man, '-N', '--version-string=' + verstr, '--include=' + footer.name, '-o', outname, abspath], check=True)

0 commit comments

Comments
 (0)