mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-18 16:42:54 +01:00
contrib: fix manpage generation
0972f55040 from #33229 broke manpage
generation, because the assumption that the last word in the line
containing the version number, was the version number, no-longer holds
for some binaries. i.e bitcoind.
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
# Distributed under the MIT software license, see the accompanying
|
# Distributed under the MIT software license, see the accompanying
|
||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
@@ -59,10 +60,11 @@ for relpath in BINARIES:
|
|||||||
print(f'{abspath} not found or not an executable', file=sys.stderr)
|
print(f'{abspath} not found or not an executable', file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
# take first line (which must contain version)
|
# take first line (which must contain version)
|
||||||
verstr = r.stdout.splitlines()[0]
|
output = r.stdout.splitlines()[0]
|
||||||
# last word of line is the actual version e.g. v22.99.0-5c6b3d5b3508
|
# find the version e.g. v30.99.0-ce771726f3e7
|
||||||
verstr = verstr.split()[-1]
|
search = re.search(r"v[0-9]\S+", output)
|
||||||
assert verstr.startswith('v')
|
assert search
|
||||||
|
verstr = search.group(0)
|
||||||
# remaining lines are copyright
|
# remaining lines are copyright
|
||||||
copyright = r.stdout.split('\n')[1:]
|
copyright = r.stdout.split('\n')[1:]
|
||||||
assert copyright[0].startswith('Copyright (C)')
|
assert copyright[0].startswith('Copyright (C)')
|
||||||
|
|||||||
Reference in New Issue
Block a user