|
13 | 13 | # serve to show the default value.
|
14 | 14 |
|
15 | 15 | import sys, os
|
| 16 | +from importlib import import_module |
| 17 | + |
| 18 | +import sphinx |
| 19 | + |
| 20 | +# Doc generation depends on being able to import project |
| 21 | +project = 'nipy' |
| 22 | +try: |
| 23 | + project_module = import_module(project) |
| 24 | +except ImportError: |
| 25 | + raise RuntimeError('Cannot import {}, please investigate'.format(project)) |
16 | 26 |
|
17 | 27 | # If your extensions are in another directory, add it here. If the directory
|
18 | 28 | # is relative to the documentation root, use os.path.abspath to make it
|
19 | 29 | # absolute, like shown here.
|
20 | 30 | sys.path.append(os.path.abspath('sphinxext'))
|
21 | 31 |
|
22 |
| -# Get project related strings. Please do not change this line to use |
23 |
| -# execfile because execfile is not available in Python 3 |
24 |
| -_info_fname = os.path.join('..', 'nipy', 'info.py') |
25 |
| -rel = {} |
26 |
| -exec(open(_info_fname, 'rt').read(), {}, rel) |
27 |
| - |
28 |
| -# Import support for ipython console session syntax highlighting (lives |
29 |
| -# in the sphinxext directory defined above) |
30 |
| -import ipython_console_highlighting |
31 |
| - |
32 | 32 | # General configuration
|
33 | 33 | # ---------------------
|
34 | 34 |
|
| 35 | +# If your documentation needs a minimal Sphinx version, state it here. |
| 36 | +needs_sphinx = '1.0' |
| 37 | + |
35 | 38 | # Add any Sphinx extension module names here, as strings. They can be extensions
|
36 | 39 | # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
37 |
| -extensions = ['sphinx.ext.autodoc', |
38 |
| - 'sphinx.ext.doctest', |
39 |
| - 'sphinx.ext.mathjax', |
40 |
| - 'sphinx.ext.autosummary', |
41 |
| - 'sphinx.ext.inheritance_diagram', |
42 |
| - 'numpy_ext.numpydoc', |
43 |
| - 'matplotlib.sphinxext.plot_directive', |
44 |
| - 'matplotlib.sphinxext.only_directives', # needed for above |
45 |
| - ] |
| 40 | +extensions = [ |
| 41 | + 'texext.mathcode', |
| 42 | + 'sphinx.ext.autodoc', |
| 43 | + 'texext.math_dollar', |
| 44 | + 'sphinx.ext.doctest', |
| 45 | + 'sphinx.ext.mathjax', |
| 46 | + 'sphinx.ext.autosummary', |
| 47 | + 'sphinx.ext.inheritance_diagram', |
| 48 | + 'matplotlib.sphinxext.plot_directive', |
| 49 | + 'IPython.sphinxext.ipython_console_highlighting', |
| 50 | +] |
46 | 51 |
|
47 | 52 | # Autosummary on
|
48 | 53 | autosummary_generate=True
|
|
56 | 61 | # The master toctree document.
|
57 | 62 | master_doc = 'index'
|
58 | 63 |
|
59 |
| -# General substitutions. |
60 |
| -project = 'nipy' |
61 |
| - |
62 |
| -#copyright = ':ref:`2005-2010, Neuroimaging in Python team. <nipy-software-license>`' |
| 64 | +# copyright = ':ref:`2005-2017, Neuroimaging in Python team. |
| 65 | +# <nipy-software-license>`' |
63 | 66 | copyright = '2005-2017, Neuroimaging in Python team'
|
64 | 67 |
|
65 | 68 | # The default replacements for |version| and |release|, also used in various
|
66 | 69 | # other places throughout the built documents.
|
67 | 70 | #
|
68 | 71 | # The short X.Y version.
|
69 |
| -version = rel['__version__'] |
| 72 | +version = project_module.__version__ |
70 | 73 | # The full version, including alpha/beta/rc tags.
|
71 | 74 | release = version
|
72 | 75 |
|
|
164 | 167 | # Options for LaTeX output
|
165 | 168 | # ------------------------
|
166 | 169 |
|
167 |
| -# The paper size ('letter' or 'a4'). |
168 |
| -#latex_paper_size = 'letter' |
| 170 | +# Additional stuff for the LaTeX preamble. |
| 171 | +_latex_preamble = """ |
| 172 | + \usepackage{amsmath} |
| 173 | + \usepackage{amssymb} |
| 174 | + % Uncomment these two if needed |
| 175 | + %\usepackage{amsfonts} |
| 176 | + %\usepackage{txfonts} |
| 177 | +""" |
| 178 | + |
| 179 | +latex_elements = { |
| 180 | +# The paper size ('letterpaper' or 'a4paper'). |
| 181 | +#'papersize': 'letterpaper', |
169 | 182 |
|
170 | 183 | # The font size ('10pt', '11pt' or '12pt').
|
171 |
| -#latex_font_size = '10pt' |
| 184 | +#'pointsize': '10pt', |
| 185 | + |
| 186 | +# Additional stuff for the LaTeX preamble. |
| 187 | +#'preamble': '', |
| 188 | + |
| 189 | +# Latex figure (float) alignment |
| 190 | +#'figure_align': 'htbp', |
| 191 | + 'preamble': _latex_preamble, |
| 192 | +} |
172 | 193 |
|
173 | 194 | # Grouping the document tree into LaTeX files. List of tuples
|
174 | 195 | # (source start file, target name, title, author, document class
|
|
183 | 204 | # the title page.
|
184 | 205 | #latex_logo = None
|
185 | 206 |
|
186 |
| -# For "manual" documents, if this is true, then toplevel headings are parts, |
187 |
| -# not chapters. |
188 |
| -latex_use_parts = True |
189 |
| - |
190 |
| -# Additional stuff for the LaTeX preamble. |
191 |
| -latex_preamble = """ |
192 |
| - \usepackage{amsmath} |
193 |
| - \usepackage{amssymb} |
194 |
| - % Uncomment these two if needed |
195 |
| - %\usepackage{amsfonts} |
196 |
| - %\usepackage{txfonts} |
197 |
| -""" |
| 207 | +if sphinx.version_info[:2] < (1, 4): |
| 208 | + # For "manual" documents, if this is true, then toplevel headings are parts, |
| 209 | + # not chapters. |
| 210 | + latex_use_parts = True |
| 211 | +else: # Sphinx >= 1.4 |
| 212 | + latex_toplevel_sectioning = 'part' |
198 | 213 |
|
199 | 214 | # Documents to append as an appendix to all manuals.
|
200 | 215 | #latex_appendices = []
|
|
0 commit comments