[PATCH 05/11] doc: only build notmuch-emacs docs if Emacs is present

David Bremner david at tethera.net
Wed Jun 13 17:32:39 PDT 2018


For notmuch-emacs-mua, this is just guessing what the user wants, but
for notmuch-emacs.rst, emacs will now be required to extract the
docstrings for the manual.
---
 doc/Makefile.local |  4 ++++
 doc/conf.py        | 24 +++++++++++++++++-------
 2 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/doc/Makefile.local b/doc/Makefile.local
index 16459e35..69853454 100644
--- a/doc/Makefile.local
+++ b/doc/Makefile.local
@@ -7,6 +7,10 @@ SPHINXOPTS    := -q
 SPHINXBUILD   = sphinx-build
 DOCBUILDDIR      := $(dir)/_build
 
+ifeq ($(WITH_EMACS),1)
+SPHINXOPTS += -t with_emacs
+endif
+
 # Internal variables.
 ALLSPHINXOPTS   := -d $(DOCBUILDDIR)/doctrees $(SPHINXOPTS) $(srcdir)/$(dir)
 APIMAN		:= $(DOCBUILDDIR)/man/man3/notmuch.3
diff --git a/doc/conf.py b/doc/conf.py
index efbafc93..25f8146c 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -29,6 +29,9 @@ release = version
 # directories to ignore when looking for source files.
 exclude_patterns = ['_build']
 
+if not tags.has('with_emacs'):
+    exclude_patterns += ['notmuch-emacs*','man1/notmuch-emacs*']
+
 # The name of the Pygments (syntax highlighting) style to use.
 pygments_style = 'sphinx'
 
@@ -81,12 +84,15 @@ man_pages = [
 
     ('man1/notmuch-dump', 'notmuch-dump',
      u'creates a plain-text dump of the tags of each message',
-     [notmuch_authors], 1),
+     [notmuch_authors], 1) ]
 
+if tags.has('with_emacs'):
+    man_pages += [
     ('man1/notmuch-emacs-mua', 'notmuch-emacs-mua',
      u'send mail with notmuch and emacs',
-     [notmuch_authors], 1),
+     [notmuch_authors], 1) ]
 
+man_pages += [
     ('man5/notmuch-hooks', 'notmuch-hooks',
      u'hooks for notmuch',
      [notmuch_authors], 5),
@@ -143,11 +149,15 @@ man_pages = [
 # If true, do not generate a @detailmenu in the "Top" node's menu.
 texinfo_no_detailmenu = True
 
-texinfo_documents = [
-    ('notmuch-emacs', 'notmuch-emacs', u'notmuch-emacs documentation',
-     notmuch_authors, 'notmuch-emacs',
-     'emacs based front-end for notmuch', 'Miscellaneous'),
-]
+if tags.has('with_emacs'):
+    texinfo_documents = [
+        ('notmuch-emacs', 'notmuch-emacs', u'notmuch-emacs documentation',
+         notmuch_authors, 'notmuch-emacs',
+         'emacs based front-end for notmuch', 'Miscellaneous'),
+    ]
+else:
+    texinfo_documents = []
+
 
 # generate texinfo list from man page list
 texinfo_documents += [
-- 
2.17.1



More information about the notmuch mailing list