Michael Johnson | 34139b0 | 2017-03-15 10:31:10 -0700 | [diff] [blame] | 1 | # -*- coding: utf-8 -*- |
| 2 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | # you may not use this file except in compliance with the License. |
| 4 | # You may obtain a copy of the License at |
| 5 | # |
| 6 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | # |
| 8 | # Unless required by applicable law or agreed to in writing, software |
| 9 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
| 11 | # implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | import os |
| 16 | import sys |
| 17 | |
Jude Cross | 986e3f5 | 2017-07-24 14:57:20 -0700 | [diff] [blame^] | 18 | import openstackdocstheme |
| 19 | from sphinx import apidoc |
| 20 | |
Michael Johnson | 34139b0 | 2017-03-15 10:31:10 -0700 | [diff] [blame] | 21 | sys.path.insert(0, os.path.abspath('../..')) |
Jude Cross | 986e3f5 | 2017-07-24 14:57:20 -0700 | [diff] [blame^] | 22 | sys.path.insert(0, os.path.abspath('.')) |
| 23 | |
Michael Johnson | 34139b0 | 2017-03-15 10:31:10 -0700 | [diff] [blame] | 24 | # -- General configuration ---------------------------------------------------- |
| 25 | |
| 26 | # Add any Sphinx extension module names here, as strings. They can be |
| 27 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. |
| 28 | extensions = [ |
| 29 | 'sphinx.ext.autodoc', |
Jude Cross | 986e3f5 | 2017-07-24 14:57:20 -0700 | [diff] [blame^] | 30 | 'sphinx.ext.viewcode', |
| 31 | 'openstackdocstheme', |
| 32 | 'oslo_config.sphinxext' |
Michael Johnson | 34139b0 | 2017-03-15 10:31:10 -0700 | [diff] [blame] | 33 | ] |
| 34 | |
| 35 | # autodoc generation is a bit aggressive and a nuisance when doing heavy |
| 36 | # text edit cycles. |
| 37 | # execute "export SPHINX_DEBUG=1" in your terminal to disable |
Jude Cross | 986e3f5 | 2017-07-24 14:57:20 -0700 | [diff] [blame^] | 38 | templates_path = ['_templates'] |
Michael Johnson | 34139b0 | 2017-03-15 10:31:10 -0700 | [diff] [blame] | 39 | |
| 40 | # The suffix of source filenames. |
| 41 | source_suffix = '.rst' |
| 42 | |
| 43 | # The master toctree document. |
| 44 | master_doc = 'index' |
| 45 | |
| 46 | # General information about the project. |
| 47 | project = u'octavia-tempest-plugin' |
| 48 | copyright = u'2017, OpenStack Foundation' |
| 49 | |
| 50 | # If true, '()' will be appended to :func: etc. cross-reference text. |
| 51 | add_function_parentheses = True |
| 52 | |
| 53 | # If true, the current module name will be prepended to all description |
| 54 | # unit titles (such as .. function::). |
Jude Cross | 986e3f5 | 2017-07-24 14:57:20 -0700 | [diff] [blame^] | 55 | add_module_names = False |
Michael Johnson | 34139b0 | 2017-03-15 10:31:10 -0700 | [diff] [blame] | 56 | |
| 57 | # The name of the Pygments (syntax highlighting) style to use. |
| 58 | pygments_style = 'sphinx' |
| 59 | |
Jude Cross | 986e3f5 | 2017-07-24 14:57:20 -0700 | [diff] [blame^] | 60 | # A list of ignored prefixes for module index sorting. |
| 61 | modindex_common_prefix = ['octavia_tempest_plugin.'] |
| 62 | |
Michael Johnson | 34139b0 | 2017-03-15 10:31:10 -0700 | [diff] [blame] | 63 | # -- Options for HTML output -------------------------------------------------- |
| 64 | |
| 65 | # The theme to use for HTML and HTML Help pages. Major themes that come with |
| 66 | # Sphinx are currently 'default' and 'sphinxdoc'. |
| 67 | # html_theme_path = ["."] |
| 68 | # html_theme = '_theme' |
| 69 | # html_static_path = ['static'] |
| 70 | |
Jude Cross | 986e3f5 | 2017-07-24 14:57:20 -0700 | [diff] [blame^] | 71 | html_theme = 'openstackdocs' |
| 72 | |
| 73 | html_last_updated_fmt = '%Y-%m-%d %H:%M' |
| 74 | |
Michael Johnson | 34139b0 | 2017-03-15 10:31:10 -0700 | [diff] [blame] | 75 | # Output file base name for HTML help builder. |
| 76 | htmlhelp_basename = '%sdoc' % project |
| 77 | |
Jude Cross | 986e3f5 | 2017-07-24 14:57:20 -0700 | [diff] [blame^] | 78 | # If false, no module index is generated. |
| 79 | html_domain_indices = True |
| 80 | |
| 81 | # If false, no index is generated. |
| 82 | html_use_index = True |
| 83 | |
Michael Johnson | 34139b0 | 2017-03-15 10:31:10 -0700 | [diff] [blame] | 84 | # Grouping the document tree into LaTeX files. List of tuples |
| 85 | # (source start file, target name, title, author, documentclass |
| 86 | # [howto/manual]). |
| 87 | latex_documents = [ |
| 88 | ('index', |
| 89 | '%s.tex' % project, |
| 90 | u'%s Documentation' % project, |
| 91 | u'OpenStack Foundation', 'manual'), |
| 92 | ] |
| 93 | |
| 94 | # Example configuration for intersphinx: refer to the Python standard library. |
| 95 | #intersphinx_mapping = {'http://docs.python.org/': None} |
Jude Cross | 986e3f5 | 2017-07-24 14:57:20 -0700 | [diff] [blame^] | 96 | |
| 97 | repository_name = 'openstack/octavia-tempest-plugin' |
| 98 | bug_project = '910' |
| 99 | bug_tag = 'docs' |
| 100 | |
| 101 | # TODO(mordred) We should extract this into a sphinx plugin |
| 102 | def run_apidoc(_): |
| 103 | cur_dir = os.path.abspath(os.path.dirname(__file__)) |
| 104 | out_dir = os.path.join(cur_dir, '_build', 'modules') |
| 105 | module = os.path.join(cur_dir, '..', '..', 'octavia_tempest_plugin') |
| 106 | # Keep the order of arguments same as the sphinx-apidoc help, otherwise it |
| 107 | # would cause unexpected errors: |
| 108 | # sphinx-apidoc [options] -o <output_path> <module_path> |
| 109 | # [exclude_pattern, ...] |
| 110 | apidoc.main([ |
| 111 | '--force', |
| 112 | '-o', |
| 113 | out_dir, |
| 114 | module, |
| 115 | ]) |
| 116 | |
| 117 | |
| 118 | def setup(app): |
| 119 | app.connect('builder-inited', run_apidoc) |