diff options
author | David Robillard <d@drobilla.net> | 2019-03-24 21:55:59 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-03-24 21:55:59 +0100 |
commit | d9cf6d2063f1f01aa5cf676e0a2fb0b7b7d8122d (patch) | |
tree | fb4b5a892b24f90e7d08da52cc82b020a742413b /wscript | |
parent | c181b3c6af79f76e8af606447c1b005df32756ac (diff) | |
download | lv2-d9cf6d2063f1f01aa5cf676e0a2fb0b7b7d8122d.tar.xz |
Add post-build phase to check for broken links in documentation
Diffstat (limited to 'wscript')
-rw-r--r-- | wscript | 22 |
1 files changed, 18 insertions, 4 deletions
@@ -44,10 +44,11 @@ def options(ctx): ctx.load('lv2') ctx.add_flags( ctx.configuration_options(), - {'no-coverage': 'Do not use gcov for code coverage', - 'online-docs': 'Build documentation for web hosting', - 'no-plugins': 'Do not build example plugins', - 'copy-headers': 'Copy headers instead of linking to bundle'}) + {'no-coverage': 'Do not use gcov for code coverage', + 'online-docs': 'Build documentation for web hosting', + 'no-check-links': 'Do not check documentation for broken links', + 'no-plugins': 'Do not build example plugins', + 'copy-headers': 'Copy headers instead of linking to bundle'}) def configure(conf): try: @@ -82,6 +83,11 @@ def configure(conf): except: Logs.warn('Asciidoc not found, book will not be built') + if not Options.options.no_check_links: + if not conf.find_program('linkchecker', + var='LINKCHECKER', mandatory=False): + Logs.warn('Documentation will not be checked for broken links') + # Check for gcov library (for test coverage) if (conf.env.BUILD_TESTS and not Options.options.no_coverage @@ -378,6 +384,14 @@ def build(bld): bld.install_files('${DOCDIR}/lv2/aux/', 'aux/style.css') bld.install_files('${DOCDIR}/lv2/ns/', 'ns/index.html') + def check_links(ctx): + import subprocess + if ctx.env.LINKCHECKER: + if subprocess.call([ctx.env.LINKCHECKER[0], '--no-status', out]): + ctx.fatal('Documentation contains broken links') + + bld.add_post_fun(check_links) + if bld.env.BUILD_TESTS: # Generate a compile test .c file that includes all headers def gen_build_test(task): |