|
Packit Service |
a04d08 |
import os
|
|
Packit Service |
a04d08 |
import sys
|
|
Packit Service |
a04d08 |
|
|
Packit Service |
a04d08 |
# If extensions (or modules to document with autodoc) are in another directory,
|
|
Packit Service |
a04d08 |
# add these directories to sys.path here. If the directory is relative to the
|
|
Packit Service |
a04d08 |
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
|
Packit Service |
a04d08 |
sys.path.insert(0, os.path.abspath('../../'))
|
|
Packit Service |
a04d08 |
sys.path.insert(0, os.path.abspath('../'))
|
|
Packit Service |
a04d08 |
sys.path.insert(0, os.path.abspath('./'))
|
|
Packit Service |
a04d08 |
sys.path.insert(0, os.path.abspath('.'))
|
|
Packit Service |
a04d08 |
|
|
Packit Service |
a04d08 |
from cloudinit import version
|
|
Packit Service |
a04d08 |
from cloudinit.config.schema import get_schema_doc
|
|
Packit Service |
a04d08 |
|
|
Packit Service |
a04d08 |
# Supress warnings for docs that aren't used yet
|
|
Packit Service |
a04d08 |
# unused_docs = [
|
|
Packit Service |
a04d08 |
# ]
|
|
Packit Service |
a04d08 |
|
|
Packit Service |
a04d08 |
# General information about the project.
|
|
Packit Service |
a04d08 |
project = 'cloud-init'
|
|
Packit Service |
a04d08 |
copyright = '2020, Canonical Ltd.'
|
|
Packit Service |
a04d08 |
|
|
Packit Service |
a04d08 |
# -- General configuration ----------------------------------------------------
|
|
Packit Service |
a04d08 |
|
|
Packit Service |
a04d08 |
# If your documentation needs a minimal Sphinx version, state it here.
|
|
Packit Service |
a04d08 |
# needs_sphinx = '1.0'
|
|
Packit Service |
a04d08 |
|
|
Packit Service |
a04d08 |
# Add any Sphinx extension module names here, as strings. They can be
|
|
Packit Service |
a04d08 |
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
|
Packit Service |
a04d08 |
extensions = [
|
|
Packit Service |
a04d08 |
'm2r',
|
|
Packit Service |
a04d08 |
'sphinx.ext.autodoc',
|
|
Packit Service |
a04d08 |
'sphinx.ext.autosectionlabel',
|
|
Packit Service |
a04d08 |
'sphinx.ext.viewcode',
|
|
Packit Service |
a04d08 |
]
|
|
Packit Service |
a04d08 |
|
|
Packit Service |
a04d08 |
# The suffix of source filenames.
|
|
Packit Service |
a04d08 |
source_suffix = '.rst'
|
|
Packit Service |
a04d08 |
|
|
Packit Service |
a04d08 |
# The master toctree document.
|
|
Packit Service |
a04d08 |
master_doc = 'index'
|
|
Packit Service |
a04d08 |
|
|
Packit Service |
a04d08 |
# The version info for the project you're documenting, acts as replacement for
|
|
Packit Service |
a04d08 |
# |version| and |release|, also used in various other places throughout the
|
|
Packit Service |
a04d08 |
# built documents.
|
|
Packit Service |
a04d08 |
version = version.version_string()
|
|
Packit Service |
a04d08 |
release = version
|
|
Packit Service |
a04d08 |
|
|
Packit Service |
a04d08 |
# Set the default Pygments syntax
|
|
Packit Service |
a04d08 |
highlight_language = 'yaml'
|
|
Packit Service |
a04d08 |
|
|
Packit Service |
a04d08 |
# List of patterns, relative to source directory, that match files and
|
|
Packit Service |
a04d08 |
# directories to ignore when looking for source files.
|
|
Packit Service |
a04d08 |
exclude_patterns = []
|
|
Packit Service |
a04d08 |
|
|
Packit Service |
a04d08 |
# If true, sectionauthor and moduleauthor directives will be shown in the
|
|
Packit Service |
a04d08 |
# output. They are ignored by default.
|
|
Packit Service |
a04d08 |
show_authors = False
|
|
Packit Service |
a04d08 |
|
|
Packit Service |
a04d08 |
# -- Options for HTML output --------------------------------------------------
|
|
Packit Service |
a04d08 |
|
|
Packit Service |
a04d08 |
# The theme to use for HTML and HTML Help pages. See the documentation for
|
|
Packit Service |
a04d08 |
# a list of builtin themes.
|
|
Packit Service |
a04d08 |
html_theme = 'sphinx_rtd_theme'
|
|
Packit Service |
a04d08 |
|
|
Packit Service |
a04d08 |
# The name of an image file (relative to this directory) to place at the top
|
|
Packit Service |
a04d08 |
# of the sidebar.
|
|
Packit Service |
a04d08 |
html_logo = 'static/logo.png'
|
|
Packit Service |
a04d08 |
|
|
Packit Service |
a04d08 |
def generate_docstring_from_schema(app, what, name, obj, options, lines):
|
|
Packit Service |
a04d08 |
"""Override module docs from schema when present."""
|
|
Packit Service |
a04d08 |
if what == 'module' and hasattr(obj, "schema"):
|
|
Packit Service |
a04d08 |
del lines[:]
|
|
Packit Service |
a04d08 |
lines.extend(get_schema_doc(obj.schema).split('\n'))
|
|
Packit Service |
a04d08 |
|
|
Packit Service |
a04d08 |
def setup(app):
|
|
Packit Service |
a04d08 |
app.connect('autodoc-process-docstring', generate_docstring_from_schema)
|