unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH 1/2] doc: pass specified configure options as tags to Sphinx
@ 2020-01-11 12:09 Jani Nikula
  2020-01-11 12:09 ` [PATCH 2/2] doc: add a hint about field processor support availability Jani Nikula
  0 siblings, 1 reply; 4+ messages in thread
From: Jani Nikula @ 2020-01-11 12:09 UTC (permalink / raw)
  To: notmuch

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-02-20 18:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-11 12:09 [PATCH 1/2] doc: pass specified configure options as tags to Sphinx Jani Nikula
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

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).