On Thu, Jan 09, 2020 at 03:31:11PM +0000, Bruce Richardson wrote:
> Add proper support for calling sphinx whenever a file in the doc
> directory changes. This is accomplished by using a wrapper script
> for sphinx, which runs sphinx but also emits a gcc-format dependency
> file listing all the doc files. This is used by ninja so that any
> change to the doc files triggers a rebuild of the docs.
> 
> Signed-off-by: Bruce Richardson <bruce.richard...@intel.com>
> Acked-by: Aaron Conole <acon...@redhat.com>
> ---
>  buildtools/call-sphinx-build.py | 23 +++++++++++++++++++++++
>  buildtools/meson.build          |  6 ++++--
>  doc/guides/meson.build          | 22 ++++++++--------------
>  3 files changed, 35 insertions(+), 16 deletions(-)
>  create mode 100755 buildtools/call-sphinx-build.py
> 
> diff --git a/buildtools/call-sphinx-build.py b/buildtools/call-sphinx-build.py
> new file mode 100755
> index 000000000..80bda2661
> --- /dev/null
> +++ b/buildtools/call-sphinx-build.py
> @@ -0,0 +1,23 @@
> +#! /usr/bin/env python3
> +# SPDX-License-Identifier: BSD-3-Clause
> +# Copyright(c) 2019 Intel Corporation
> +#
> +
> +import sys
> +import os
> +from os.path import join
> +from subprocess import run
> +
> +(sphinx, src, dst) = sys.argv[1:]  # assign parameters to variables
> +
> +# find all the files sphinx will process so we can write them as dependencies
> +srcfiles = []
> +for root, dirs, files in os.walk(src):
> +    srcfiles.extend([join(root, f) for f in files])
> +
> +# run sphinx, putting the html output in a "html" directory
> +run([sphinx, '-j', 'auto', '-b', 'html', src, join(dst, 'html')], check=True)
> +

Looking in travis, it appears that sphinx there is too old to support the
"-j auto" flag, so I'll do a new revision to fix that.

/Bruce

Reply via email to