mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-09 11:27:28 -03:00
gen-manpages: implement --skip-missing-binaries
With --skip-missing-binaries, instead of stopping the execution of gen-manpages.py when a binary is not found, continue generating manpages for the available binaries and skip the missing ones.
This commit is contained in:
parent
65f6e7078b
commit
299e2220e9
1 changed files with 19 additions and 2 deletions
|
@ -6,6 +6,7 @@ import os
|
|||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import argparse
|
||||
|
||||
BINARIES = [
|
||||
'src/bitcoind',
|
||||
|
@ -16,6 +17,18 @@ BINARIES = [
|
|||
'src/qt/bitcoin-qt',
|
||||
]
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
)
|
||||
parser.add_argument(
|
||||
"-s",
|
||||
"--skip-missing-binaries",
|
||||
action="store_true",
|
||||
default=False,
|
||||
help="skip generation for binaries that are not found in the build path",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
# Paths to external utilities.
|
||||
git = os.getenv('GIT', 'git')
|
||||
help2man = os.getenv('HELP2MAN', 'help2man')
|
||||
|
@ -38,8 +51,12 @@ for relpath in BINARIES:
|
|||
try:
|
||||
r = subprocess.run([abspath, "--version"], stdout=subprocess.PIPE, check=True, text=True)
|
||||
except IOError:
|
||||
print(f'{abspath} not found or not an executable', file=sys.stderr)
|
||||
sys.exit(1)
|
||||
if(args.skip_missing_binaries):
|
||||
print(f'{abspath} not found or not an executable. Skipping...', file=sys.stderr)
|
||||
continue
|
||||
else:
|
||||
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.splitlines()[0]
|
||||
# last word of line is the actual version e.g. v22.99.0-5c6b3d5b3508
|
||||
|
|
Loading…
Reference in a new issue