]> git.cworth.org Git - notmuch-old/blob - doc/conf.py
doc: set up for autoapi / readthedocs compatibility
[notmuch-old] / doc / conf.py
1
2 # -*- coding: utf-8 -*-
3
4 import sys
5 import os
6
7 location = os.path.dirname(__file__)
8 bindings_path =  os.path.join(location, '..', 'bindings', 'python-cffi','notmuch2')
9 exclude_patterns = ['_build']
10
11 # read generated config
12 for pathdir in ['.', '..']:
13     conf_file = os.path.join(location,pathdir,'sphinx.config')
14     if os.path.exists(conf_file):
15         with open(conf_file,'r') as infile:
16             exec(''.join(infile.readlines()))
17
18 if tags.has("AUTOAPI") or os.environ.get('READTHEDOCS') == 'True':
19     extensions = [ 'autoapi.extension' ]
20     autoapi_dirs = [ bindings_path ]
21     autoapi_add_toctree_entry = False
22     exclude_patterns.append('python-autodoc.rst')
23 elif tags.has('WITH_PYTHON'):
24     extensions = [ 'sphinx.ext.autodoc' ]
25     sys.path.insert(0, bindings_path)
26     exclude_patterns.append('python-autoapi.rst')
27 else:
28     exclude_patterns.append('python-autodoc.rst', 'python-autoapi.rst')
29
30 # The suffix of source filenames.
31 source_suffix = '.rst'
32
33 # The master toctree document.
34 master_doc = 'index'
35
36 # General information about the project.
37 project = u'notmuch'
38 copyright = u'2009-2020, Carl Worth and many others'
39
40 for pathdir in ['.', '..']:
41     version_file = os.path.join(location,pathdir,'version')
42     if os.path.exists(version_file):
43         with open(version_file,'r') as infile:
44             version=infile.read().replace('\n','')
45
46 # The full version, including alpha/beta/rc tags.
47 release = version
48
49 if tags.has('WITH_EMACS'):
50     # Hacky reimplementation of include to workaround limitations of
51     # sphinx-doc
52     lines = ['.. include:: /../emacs/rstdoc.rsti\n\n'] # in the source tree
53     for file in ('notmuch.rsti', 'notmuch-lib.rsti', 'notmuch-show.rsti', 'notmuch-tag.rsti'):
54         lines.extend(open(rsti_dir+'/'+file))
55     rst_epilog = ''.join(lines)
56     del lines
57 else:
58     # If we don't have emacs (or the user configured --without-emacs),
59     # don't build the notmuch-emacs docs, as they need emacs to generate
60     # the docstring include files
61     exclude_patterns.append('notmuch-emacs.rst')
62
63 # The name of the Pygments (syntax highlighting) style to use.
64 pygments_style = 'sphinx'
65
66 # -- Options for HTML output ----------------------------------------------
67
68 # The theme to use for HTML and HTML Help pages.  See the documentation for
69 # a list of builtin themes.
70 html_theme = 'default'
71
72
73 # Add any paths that contain custom static files (such as style sheets) here,
74 # relative to this directory. They are copied after the builtin static files,
75 # so a file named "default.css" will overwrite the builtin "default.css".
76 html_static_path = []
77
78 # Output file base name for HTML help builder.
79 htmlhelp_basename = 'notmuchdoc'
80
81 # Disable SmartyPants, as it mangles command lines.
82 # Despite the name, this actually affects manual pages as well.
83 html_use_smartypants = False
84
85 # -- Options for manual page output ---------------------------------------
86
87 # One entry per manual page. List of tuples
88 # (source start file, name, description, authors, manual section).
89
90 notmuch_authors = u'Carl Worth and many others'
91
92 man_pages = [
93     ('man1/notmuch', 'notmuch',
94      u'thread-based email index, search, and tagging',
95      [notmuch_authors], 1),
96
97     ('man1/notmuch-address', 'notmuch-address',
98      u'output addresses from matching messages',
99      [notmuch_authors], 1),
100
101     ('man1/notmuch-compact', 'notmuch-compact',
102      u'compact the notmuch database',
103      [notmuch_authors], 1),
104
105     ('man1/notmuch-config', 'notmuch-config',
106      u'access notmuch configuration file',
107      [notmuch_authors], 1),
108
109     ('man1/notmuch-count', 'notmuch-count',
110      u'count messages matching the given search terms',
111      [notmuch_authors], 1),
112
113     ('man1/notmuch-dump', 'notmuch-dump',
114      u'creates a plain-text dump of the tags of each message',
115      [notmuch_authors], 1),
116
117     ('man1/notmuch-emacs-mua', 'notmuch-emacs-mua',
118      u'send mail with notmuch and emacs',
119      [notmuch_authors], 1),
120
121     ('man5/notmuch-hooks', 'notmuch-hooks',
122      u'hooks for notmuch',
123      [notmuch_authors], 5),
124
125     ('man1/notmuch-insert', 'notmuch-insert',
126      u'add a message to the maildir and notmuch database',
127      [notmuch_authors], 1),
128
129     ('man1/notmuch-new', 'notmuch-new',
130      u'incorporate new mail into the notmuch database',
131      [notmuch_authors], 1),
132
133     ('man7/notmuch-properties', 'notmuch-properties',
134      u'notmuch message property conventions and documentation',
135      [notmuch_authors], 7),
136
137     ('man1/notmuch-reindex', 'notmuch-reindex',
138      u're-index matching messages',
139      [notmuch_authors], 1),
140
141     ('man1/notmuch-reply', 'notmuch-reply',
142      u'constructs a reply template for a set of messages',
143      [notmuch_authors], 1),
144
145     ('man1/notmuch-restore', 'notmuch-restore',
146      u'restores the tags from the given file (see notmuch dump)',
147      [notmuch_authors], 1),
148
149     ('man1/notmuch-search', 'notmuch-search',
150      u'search for messages matching the given search terms',
151      [notmuch_authors], 1),
152
153     ('man7/notmuch-search-terms', 'notmuch-search-terms',
154      u'syntax for notmuch queries',
155      [notmuch_authors], 7),
156
157     ('man1/notmuch-show', 'notmuch-show',
158      u'show messages matching the given search terms',
159      [notmuch_authors], 1),
160
161     ('man1/notmuch-tag', 'notmuch-tag',
162      u'add/remove tags for all messages matching the search terms',
163      [notmuch_authors], 1),
164 ]
165
166 # If true, show URL addresses after external links.
167 #man_show_urls = False
168
169 # -- Options for Texinfo output -------------------------------------------
170
171 # Grouping the document tree into Texinfo files. List of tuples
172 # (source start file, target name, title, author,
173 #  dir menu entry, description, category)
174 # If true, do not generate a @detailmenu in the "Top" node's menu.
175 texinfo_no_detailmenu = True
176
177 texinfo_documents = [
178     ('notmuch-emacs', 'notmuch-emacs', u'notmuch-emacs documentation',
179      notmuch_authors, 'notmuch-emacs',
180      'emacs based front-end for notmuch', 'Miscellaneous'),
181 ]
182
183 # generate texinfo list from man page list
184 texinfo_documents += [
185     (
186         x[0],                           # source start file
187         x[1],                           # target name
188         x[1] + u' documentation',       # title
189         x[3][0],                        # author
190         x[1],                           # dir menu entry
191         x[2],                           # description
192         'Miscellaneous'                 # category
193     ) for x in man_pages]