From: Jani Nikula <jani@nikula.org>
To: notmuch@notmuchmail.org
Subject: [PATCH 1/2] doc: pass specified configure options as tags to Sphinx
Date: Sat, 11 Jan 2020 14:09:14 +0200 [thread overview]
Message-ID: <20200111120915.5944-1-jani@nikula.org> (raw)
Add generic support for passing enabled configure options as tags to
Sphinx. Add TAGS make variable to specify the configure options, and
use the sphinx-build -t option to add the options equal to 1 as tags.
The tags may be used in conf.py to conditionally adjust the
configuration [1], and to conditionally include content blocks in rst
files using the Sphinx "only" directive [2].
Initially, convert WITH_EMACS to a tag.
[1] https://www.sphinx-doc.org/en/master/usage/configuration.html#conf-tags
[2] https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#tags
---
doc/Makefile.local | 9 +++++++--
doc/conf.py | 2 +-
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/doc/Makefile.local b/doc/Makefile.local
index b4e0c9558101..c78aea49a108 100644
--- a/doc/Makefile.local
+++ b/doc/Makefile.local
@@ -4,11 +4,16 @@ dir := doc
# You can set these variables from the command line.
SPHINXOPTS := -q
-SPHINXBUILD = WITH_EMACS=${WITH_EMACS} sphinx-build
+SPHINXBUILD = sphinx-build
DOCBUILDDIR := $(dir)/_build
+# Configure options to be added as Sphinx tags.
+# Add "-t <tag>" for each make variable in TAGS that equals 1.
+TAGS := WITH_EMACS
+TAGOPTS := $(patsubst %=1,-t %,$(filter %=1,$(foreach tag,$(TAGS),$(tag)=$(value $(tag)))))
+
# Internal variables.
-ALLSPHINXOPTS := $(SPHINXOPTS) $(srcdir)/$(dir)
+ALLSPHINXOPTS := $(SPHINXOPTS) $(TAGOPTS) $(srcdir)/$(dir)
APIMAN := $(DOCBUILDDIR)/man/man3/notmuch.3
DOXYFILE := $(srcdir)/$(dir)/doxygen.cfg
diff --git a/doc/conf.py b/doc/conf.py
index fc9738ff092a..2ee063d77f10 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -32,7 +32,7 @@ exclude_patterns = ['_build']
# If we don't have emacs (or the user configured --without-emacs),
# don't build the notmuch-emacs docs, as they need emacs to generate
# the docstring include files
-if os.environ.get('WITH_EMACS') != '1':
+if not tags.has('WITH_EMACS'):
exclude_patterns.append('notmuch-emacs.rst')
# The name of the Pygments (syntax highlighting) style to use.
--
2.20.1
next reply other threads:[~2020-01-11 12:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-11 12:09 Jani Nikula [this message]
2020-01-11 12:09 ` [PATCH 2/2] doc: add a hint about field processor support availability Jani Nikula
2020-01-12 15:13 ` Tomi Ollila
2020-02-20 17:53 ` Daniel Kahn Gillmor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200111120915.5944-1-jani@nikula.org \
--to=jani@nikula.org \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).