diff --git a/contrib/devtools/gen-manpages.py b/contrib/devtools/gen-manpages.py index 2860e7db99441d..8d7fa325a880fe 100755 --- a/contrib/devtools/gen-manpages.py +++ b/contrib/devtools/gen-manpages.py @@ -6,6 +6,7 @@ import subprocess import sys import tempfile +import configparser BINARIES = [ 'src/bitcoind', @@ -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. @@ -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) \ No newline at end of file