|
6 | 6 | import subprocess
|
7 | 7 | import sys
|
8 | 8 | import tempfile
|
| 9 | +import argparse |
9 | 10 |
|
10 | 11 | BINARIES = [
|
11 | 12 | 'src/bitcoind',
|
|
16 | 17 | 'src/qt/bitcoin-qt',
|
17 | 18 | ]
|
18 | 19 |
|
| 20 | +parser = argparse.ArgumentParser( |
| 21 | + formatter_class=argparse.RawDescriptionHelpFormatter, |
| 22 | +) |
| 23 | +parser.add_argument( |
| 24 | + "-s", |
| 25 | + "--skip-missing-binaries", |
| 26 | + action="store_true", |
| 27 | + default=False, |
| 28 | + help="skip generation for binaries that are not found in the build path", |
| 29 | +) |
| 30 | +args = parser.parse_args() |
| 31 | + |
19 | 32 | # Paths to external utilities.
|
20 | 33 | git = os.getenv('GIT', 'git')
|
21 | 34 | help2man = os.getenv('HELP2MAN', 'help2man')
|
|
38 | 51 | try:
|
39 | 52 | r = subprocess.run([abspath, "--version"], stdout=subprocess.PIPE, check=True, text=True)
|
40 | 53 | except IOError:
|
41 |
| - print(f'{abspath} not found or not an executable', file=sys.stderr) |
42 |
| - sys.exit(1) |
| 54 | + if(args.skip_missing_binaries): |
| 55 | + print(f'{abspath} not found or not an executable. Skipping...', file=sys.stderr) |
| 56 | + continue |
| 57 | + else: |
| 58 | + print(f'{abspath} not found or not an executable', file=sys.stderr) |
| 59 | + sys.exit(1) |
43 | 60 | # take first line (which must contain version)
|
44 | 61 | verstr = r.stdout.splitlines()[0]
|
45 | 62 | # last word of line is the actual version e.g. v22.99.0-5c6b3d5b3508
|
|
51 | 68 |
|
52 | 69 | versions.append((abspath, verstr, copyright))
|
53 | 70 |
|
| 71 | +if not versions: |
| 72 | + print(f'No binaries found in {builddir}. Please ensure the binaries are present in {builddir}, or set another build path using the BUILDDIR env variable.') |
| 73 | + sys.exit(1) |
| 74 | + |
54 | 75 | if any(verstr.endswith('-dirty') for (_, verstr, _) in versions):
|
55 | 76 | print("WARNING: Binaries were built from a dirty tree.")
|
56 | 77 | print('man pages generated from dirty binaries should NOT be committed.')
|
|
0 commit comments