Skip to content

Commit

Permalink
doc: Fix gen-manpages to check build options
Browse files Browse the repository at this point in the history
  • Loading branch information
BrandonOdiwuor committed Feb 21, 2024
1 parent 3cbc8cb commit efb45f0
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion 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 configparser

BINARIES = [
'src/bitcoind',
Expand Down Expand Up @@ -57,6 +58,30 @@
print('To properly generate man pages, please commit your changes (or discard them), rebuild, then run this script again.')
print()

# Check enabled build options
config = configparser.ConfigParser()
conffile = os.path.join(builddir, 'test/config.ini')
config.read(conffile)

error_message = "Aborting generating manpages…\nError: {component} support is not enabled.\nPlease enable it and try again."

if not config['components'].getboolean('HAVE_SYSTEM'):
print(error_message.format(component="System components"))
sys.exit(1)

if not config['components'].getboolean('ENABLE_WALLET'):
print(error_message.format(component="Wallet functionality"))
sys.exit(1)

if not config['components'].getboolean('USE_UPNP'):
print(error_message.format(component="UPnP"))
sys.exit(1)

if not config['components'].getboolean('ENABLE_ZMQ'):
print(error_message.format(component="ZMQ"))
sys.exit(1)


with tempfile.NamedTemporaryFile('w', suffix='.h2m') as footer:
# Create copyright footer, and write it to a temporary include file.
# Copyright is the same for all binaries, so just use the first.
Expand All @@ -68,4 +93,4 @@
for (abspath, verstr, _) in versions:
outname = os.path.join(mandir, os.path.basename(abspath) + '.1')
print(f'Generating {outname}…')
subprocess.run([help2man, '-N', '--version-string=' + verstr, '--include=' + footer.name, '-o', outname, abspath], check=True)
subprocess.run([help2man, '-N', '--version-string=' + verstr, '--include=' + footer.name, '-o', outname, abspath], check=True)

0 comments on commit efb45f0

Please sign in to comment.