|
| 1 | +#!/usr/bin/env python3 |
| 2 | +# -*- coding: utf-8 -*- |
| 3 | +# |
| 4 | +# labgrid documentation build configuration file, created by |
| 5 | +# sphinx-quickstart on Mon Feb 20 10:00:00 2017. |
| 6 | +# |
| 7 | +# This file is execfile()d with the current directory set to its |
| 8 | +# containing dir. |
| 9 | +# |
| 10 | +# Note that not all possible configuration values are present in this |
| 11 | +# autogenerated file. |
| 12 | +# |
| 13 | +# All configuration values have a default; values that are commented out |
| 14 | +# serve to show the default. |
| 15 | + |
| 16 | +# If extensions (or modules to document with autodoc) are in another directory, |
| 17 | +# add these directories to sys.path here. If the directory is relative to the |
| 18 | +# documentation root, use os.path.abspath to make it absolute, like shown here. |
| 19 | +# |
| 20 | +import os |
| 21 | +import sys |
| 22 | +sys.path.insert(0, os.path.abspath('..')) |
| 23 | + |
| 24 | +from pkg_resources import get_distribution |
| 25 | + |
| 26 | +# Import read_the_docs theme |
| 27 | +import sphinx_rtd_theme |
| 28 | + |
| 29 | +# -- General configuration ------------------------------------------------ |
| 30 | + |
| 31 | +# If your documentation needs a minimal Sphinx version, state it here. |
| 32 | +# |
| 33 | +# needs_sphinx = '1.0' |
| 34 | + |
| 35 | +# Add any Sphinx extension module names here, as strings. They can be |
| 36 | +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom |
| 37 | +# ones. |
| 38 | +extensions = ['sphinx.ext.autodoc', |
| 39 | + 'sphinx.ext.napoleon', |
| 40 | + 'sphinx.ext.coverage', |
| 41 | + 'sphinx.ext.viewcode', |
| 42 | + 'sphinx.ext.autosectionlabel'] |
| 43 | + |
| 44 | +# Add any paths that contain templates here, relative to this directory. |
| 45 | +templates_path = ['.templates'] |
| 46 | + |
| 47 | +# The suffix(es) of source filenames. |
| 48 | +# You can specify multiple suffix as a list of string: |
| 49 | +# |
| 50 | +# source_suffix = ['.rst', '.md'] |
| 51 | +source_suffix = '.rst' |
| 52 | + |
| 53 | +# The master toctree document. |
| 54 | +master_doc = 'index' |
| 55 | + |
| 56 | +# General information about the project. |
| 57 | +project = 'labgridhelper' |
| 58 | +copyright = '2019 Pengutronix, Jan Luebbe and Rouven Czerwinski' |
| 59 | +author = 'Rouven Czerwinski' |
| 60 | + |
| 61 | +# The version info for the project you're documenting, acts as replacement for |
| 62 | +# |version| and |release|, also used in various other places throughout the |
| 63 | +# built documents. |
| 64 | +# |
| 65 | +# The full version, including alpha/beta/rc tags. |
| 66 | +release = get_distribution('labgridhelper').version |
| 67 | +# The short X.Y version. |
| 68 | +version = '.'.join(release.split('.')[:2]) |
| 69 | + |
| 70 | +# The language for content autogenerated by Sphinx. Refer to documentation |
| 71 | +# for a list of supported languages. |
| 72 | +# |
| 73 | +# This is also used if you do content translation via gettext catalogs. |
| 74 | +# Usually you set "language" from the command line for these cases. |
| 75 | +language = None |
| 76 | + |
| 77 | +# List of patterns, relative to source directory, that match files and |
| 78 | +# directories to ignore when looking for source files. |
| 79 | +# This patterns also effect to html_static_path and html_extra_path |
| 80 | +exclude_patterns = ['.build', 'Thumbs.db', '.DS_Store'] |
| 81 | + |
| 82 | +# The name of the Pygments (syntax highlighting) style to use. |
| 83 | +pygments_style = 'sphinx' |
| 84 | + |
| 85 | +# If true, `todo` and `todoList` produce output, else they produce nothing. |
| 86 | +todo_include_todos = False |
| 87 | + |
| 88 | + |
| 89 | +# -- Options for HTML output ---------------------------------------------- |
| 90 | + |
| 91 | +# The theme to use for HTML and HTML Help pages. See the documentation for |
| 92 | +# a list of builtin themes. |
| 93 | +# |
| 94 | +html_theme = 'sphinx_rtd_theme' |
| 95 | + |
| 96 | +# Set correct html_path for rtd theme: |
| 97 | +html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] |
| 98 | + |
| 99 | +# Theme options are theme-specific and customize the look and feel of a theme |
| 100 | +# further. For a list of options available for each theme, see the |
| 101 | +# documentation. |
| 102 | +# |
| 103 | +# html_theme_options = {} |
| 104 | + |
| 105 | +# Add any paths that contain custom static files (such as style sheets) here, |
| 106 | +# relative to this directory. They are copied after the builtin static files, |
| 107 | +# so a file named "default.css" will overwrite the builtin "default.css". |
| 108 | +html_static_path = [] |
| 109 | + |
| 110 | + |
| 111 | +# -- Options for HTMLHelp output ------------------------------------------ |
| 112 | + |
| 113 | +# Output file base name for HTML help builder. |
| 114 | +htmlhelp_basename = 'labgriddoc' |
| 115 | + |
| 116 | + |
| 117 | +# -- Options for LaTeX output --------------------------------------------- |
| 118 | + |
| 119 | +latex_elements = { |
| 120 | + # The paper size ('letterpaper' or 'a4paper'). |
| 121 | + # |
| 122 | + # 'papersize': 'letterpaper', |
| 123 | + |
| 124 | + # The font size ('10pt', '11pt' or '12pt'). |
| 125 | + # |
| 126 | + # 'pointsize': '10pt', |
| 127 | + |
| 128 | + # Additional stuff for the LaTeX preamble. |
| 129 | + # |
| 130 | + # 'preamble': '', |
| 131 | + |
| 132 | + # Latex figure (float) alignment |
| 133 | + # |
| 134 | + # 'figure_align': 'htbp', |
| 135 | +} |
| 136 | + |
| 137 | +# Grouping the document tree into LaTeX files. List of tuples |
| 138 | +# (source start file, target name, title, |
| 139 | +# author, documentclass [howto, manual, or own class]). |
| 140 | +latex_documents = [ |
| 141 | + (master_doc, 'labgridhelper.tex', 'labgridhelper Documentation', |
| 142 | + author, 'manual'), |
| 143 | +] |
| 144 | + |
| 145 | + |
| 146 | +# -- Options for manual page output --------------------------------------- |
| 147 | + |
| 148 | +# One entry per manual page. List of tuples |
| 149 | +# (source start file, name, description, authors, manual section). |
| 150 | +man_pages = [ |
| 151 | + (master_doc, 'labgridhelper', 'labgridhelper Documentation', |
| 152 | + [author], 1) |
| 153 | +] |
| 154 | + |
| 155 | + |
| 156 | +# -- Options for Texinfo output ------------------------------------------- |
| 157 | + |
| 158 | +# Grouping the document tree into Texinfo files. List of tuples |
| 159 | +# (source start file, target name, title, author, |
| 160 | +# dir menu entry, description, category) |
| 161 | +texinfo_documents = [ |
| 162 | + (master_doc, 'labgridhelper', 'labgridhelper Documentation', |
| 163 | + author, 'labgrid', 'Helper functions for the labgrid library', |
| 164 | + 'Miscellaneous'), |
| 165 | +] |
| 166 | + |
| 167 | + |
| 168 | +# -- Options for autodoc -------------------------------------------------- |
| 169 | + |
| 170 | +autodoc_member_order = 'bysource' |
| 171 | +autodoc_default_flags = ['special-members'] |
| 172 | +autodoc_mock_imports = ['labgrid', |
| 173 | + 'labgrid.driver', |
| 174 | + 'labgrid.protocol'] |
| 175 | + |
| 176 | +# -- Options for autosection ---------------------------------------------- |
| 177 | +autosectionlabel_prefix_document = True |
| 178 | + |
| 179 | + |
| 180 | +from unittest.mock import Mock |
| 181 | +for mod in autodoc_mock_imports: |
| 182 | + sys.modules[mod] = Mock() |
| 183 | + |
| 184 | +def run_apidoc(app): |
| 185 | + from sphinx.apidoc import main |
| 186 | + module = os.path.abspath(os.path.join(app.srcdir, '..', 'labgridhelper')) |
| 187 | + output = os.path.abspath(os.path.join(app.srcdir, 'modules')) |
| 188 | + cmd = ['sphinx-apidoc', module, '-M', '-H', 'Modules', '-o', output] |
| 189 | + main(cmd) |
| 190 | + |
| 191 | +def setup(app): |
| 192 | + app.connect('builder-inited', run_apidoc) |
0 commit comments