aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/devtools/gen-manpages.py20
1 files changed, 9 insertions, 11 deletions
diff --git a/contrib/devtools/gen-manpages.py b/contrib/devtools/gen-manpages.py
index 05f613da38..26612cc444 100755
--- a/contrib/devtools/gen-manpages.py
+++ b/contrib/devtools/gen-manpages.py
@@ -32,7 +32,6 @@ mandir = os.getenv('MANDIR', os.path.join(topdir, 'doc/man'))
# Verify that all the required binaries are usable, and extract copyright
# message in a first pass.
-copyright = None
versions = []
for relpath in BINARIES:
abspath = os.path.join(builddir, relpath)
@@ -42,18 +41,17 @@ for relpath in BINARIES:
print(f'{abspath} not found or not an executable', file=sys.stderr)
sys.exit(1)
# take first line (which must contain version)
- verstr = r.stdout.split('\n')[0]
+ verstr = r.stdout.splitlines()[0]
# last word of line is the actual version e.g. v22.99.0-5c6b3d5b3508
verstr = verstr.split()[-1]
assert verstr.startswith('v')
+ # remaining lines are copyright
+ copyright = r.stdout.split('\n')[1:]
+ assert copyright[0].startswith('Copyright (C)')
- # Only bitcoin-qt prints the copyright message on --version, so store it specifically.
- if relpath == 'src/qt/bitcoin-qt':
- copyright = r.stdout.split('\n')[1:]
+ versions.append((abspath, verstr, copyright))
- versions.append((abspath, verstr))
-
-if any(verstr.endswith('-dirty') for (_, verstr) in versions):
+if any(verstr.endswith('-dirty') for (_, verstr, _) in versions):
print("WARNING: Binaries were built from a dirty tree.")
print('man pages generated from dirty binaries should NOT be committed.')
print('To properly generate man pages, please commit your changes (or discard them), rebuild, then run this script again.')
@@ -61,13 +59,13 @@ if any(verstr.endswith('-dirty') for (_, verstr) in versions):
with tempfile.NamedTemporaryFile('w', suffix='.h2m') as footer:
# Create copyright footer, and write it to a temporary include file.
- assert copyright
+ # Copyright is the same for all binaries, so just use the first.
footer.write('[COPYRIGHT]\n')
- footer.write('\n'.join(copyright).strip())
+ footer.write('\n'.join(versions[0][2]).strip())
footer.flush()
# Call the binaries through help2man to produce a manual page for each of them.
- for (abspath, verstr) in versions:
+ for (abspath, verstr, _) in versions:
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)