Skip to content

Commit

Permalink
gen-manpages: implement --skip-missing-binaries
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
andremralves committed Nov 14, 2024
1 parent 65f6e70 commit 299e222
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions contrib/devtools/gen-manpages.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import subprocess
import sys
import tempfile
import argparse

BINARIES = [
'src/bitcoind',
Expand All @@ -16,6 +17,18 @@
'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')
Expand All @@ -38,8 +51,12 @@
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
Expand Down

0 comments on commit 299e222

Please sign in to comment.