mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 23:09:44 -04: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 subprocess
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import argparse
|
||||||
|
|
||||||
BINARIES = [
|
BINARIES = [
|
||||||
'src/bitcoind',
|
'src/bitcoind',
|
||||||
|
@ -16,6 +17,18 @@ BINARIES = [
|
||||||
'src/qt/bitcoin-qt',
|
'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.
|
# Paths to external utilities.
|
||||||
git = os.getenv('GIT', 'git')
|
git = os.getenv('GIT', 'git')
|
||||||
help2man = os.getenv('HELP2MAN', 'help2man')
|
help2man = os.getenv('HELP2MAN', 'help2man')
|
||||||
|
@ -38,6 +51,10 @@ for relpath in BINARIES:
|
||||||
try:
|
try:
|
||||||
r = subprocess.run([abspath, "--version"], stdout=subprocess.PIPE, check=True, text=True)
|
r = subprocess.run([abspath, "--version"], stdout=subprocess.PIPE, check=True, text=True)
|
||||||
except IOError:
|
except IOError:
|
||||||
|
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)
|
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)
|
||||||
|
|
Loading…
Add table
Reference in a new issue