|
32 | 32 |
|
33 | 33 | # Verify that all the required binaries are usable, and extract copyright |
34 | 34 | # message in a first pass. |
35 | | -copyright = None |
36 | 35 | versions = [] |
37 | 36 | for relpath in BINARIES: |
38 | 37 | abspath = os.path.join(builddir, relpath) |
|
42 | 41 | print(f'{abspath} not found or not an executable', file=sys.stderr) |
43 | 42 | sys.exit(1) |
44 | 43 | # take first line (which must contain version) |
45 | | - verstr = r.stdout.split('\n')[0] |
| 44 | + verstr = r.stdout.splitlines()[0] |
46 | 45 | # last word of line is the actual version e.g. v22.99.0-5c6b3d5b3508 |
47 | 46 | verstr = verstr.split()[-1] |
48 | 47 | assert verstr.startswith('v') |
| 48 | + # remaining lines are copyright |
| 49 | + copyright = r.stdout.split('\n')[1:] |
| 50 | + assert copyright[0].startswith('Copyright (C)') |
49 | 51 |
|
50 | | - # Only dash-qt prints the copyright message on --version, so store it specifically. |
51 | | - if relpath == 'src/qt/dash-qt': |
52 | | - copyright = r.stdout.split('\n')[1:] |
| 52 | + versions.append((abspath, verstr, copyright)) |
53 | 53 |
|
54 | | - versions.append((abspath, verstr)) |
55 | | - |
56 | | -if any(verstr.endswith('-dirty') for (_, verstr) in versions): |
| 54 | +if any(verstr.endswith('-dirty') for (_, verstr, _) in versions): |
57 | 55 | print("WARNING: Binaries were built from a dirty tree.") |
58 | 56 | print('man pages generated from dirty binaries should NOT be committed.') |
59 | 57 | print('To properly generate man pages, please commit your changes (or discard them), rebuild, then run this script again.') |
60 | 58 | print() |
61 | 59 |
|
62 | 60 | with tempfile.NamedTemporaryFile('w', suffix='.h2m') as footer: |
63 | 61 | # Create copyright footer, and write it to a temporary include file. |
64 | | - assert copyright |
| 62 | + # Copyright is the same for all binaries, so just use the first. |
65 | 63 | footer.write('[COPYRIGHT]\n') |
66 | | - footer.write('\n'.join(copyright).strip()) |
| 64 | + footer.write('\n'.join(versions[0][2]).strip()) |
67 | 65 | footer.flush() |
68 | 66 |
|
69 | 67 | # Call the binaries through help2man to produce a manual page for each of them. |
70 | | - for (abspath, verstr) in versions: |
| 68 | + for (abspath, verstr, _) in versions: |
71 | 69 | outname = os.path.join(mandir, os.path.basename(abspath) + '.1') |
72 | 70 | print(f'Generating {outname}…') |
73 | 71 | subprocess.run([help2man, '-N', '--version-string=' + verstr, '--include=' + footer.name, '-o', outname, abspath], check=True) |
0 commit comments