Re: [PATCH 1/2] doc: replace use of environment variables with a generated config

Subject: Re: [PATCH 1/2] doc: replace use of environment variables with a generated config

Date: Sat, 11 Jul 2020 17:00:57 +0300

To: David Bremner, notmuch@notmuchmail.org

Cc: flub@devork.be, David Bremner

From: Tomi Ollila


On Sat, Jul 11 2020, David Bremner wrote:

> I don't love the use of exec, but it is getting unwieldy to pass
> configuration options on the sphinx-build command line, and I
> anticipate further use of conditionals.

Perhaps less "opinions" in commit message.

(and as I think I don't comment 2/2, s/seperate/separate/ there)


> ---
>  configure          |  8 ++++++++
>  doc/Makefile.local |  2 +-
>  doc/conf.py        | 11 ++++++++---
>  3 files changed, 17 insertions(+), 4 deletions(-)
>
> diff --git a/configure b/configure
> index 80cbac4f..177432db 100755
> --- a/configure
> +++ b/configure
> @@ -1548,6 +1548,14 @@ NOTMUCH_HAVE_PYTHON3_PYTEST=${have_python3_pytest}
>  PLATFORM=${platform}
>  EOF
>  
> +cat > sphinx.config <<EOF
> +# Generate by configure, run from doc/conf.py
> +EOF
> +if [ $WITH_EMACS = "1" ]; then
> +    printf "tags.add('WITH_EMACS')\n" >> sphinx.config
> +fi
> +printf "rsti_dir = '%s'\n" $(realpath emacs) >> sphinx.config
> +

perhaps instead of multiple redirections to the file, 

{
    echo "# Generated by configure, run from doc/conf.py"
    echo
    if [ $WITH_EMACS = "1" ]; then
        printf "tags.add('WITH_EMACS')\n"
    fi 
    printf "rsti_dir = '%s'\n" "$(realpath emacs)"

} > sphinx.config
    
alternative (someone might think less readable... ;/):

 exec 3>&1 1> sphinx.config

 echo "# Generated by configure, run from doc/conf.py"
 ...

 exec 1>&3 3>&-


>  # Finally, after everything configured, inform the user how to continue.
>  cat <<EOF
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: