2019-06-06 18:25:46 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
#
|
|
|
|
# Configuration file for the Sphinx documentation builder.
|
|
|
|
#
|
|
|
|
# This file does only contain a selection of the most common options. For a
|
|
|
|
# full list see the documentation:
|
|
|
|
# http://www.sphinx-doc.org/en/master/config
|
|
|
|
|
2024-06-07 11:43:43 +03:00
|
|
|
import os
|
2025-04-03 11:41:40 +03:00
|
|
|
import re
|
2024-06-07 11:43:43 +03:00
|
|
|
import sys
|
|
|
|
from shutil import copyfile
|
|
|
|
|
2019-06-06 18:25:46 +02:00
|
|
|
# -- Path setup --------------------------------------------------------------
|
|
|
|
|
2024-06-07 11:43:43 +03:00
|
|
|
# to avoid sphinx.errors.SphinxParallelError: RecursionError: maximum recursion depth exceeded while pickling an object
|
|
|
|
sys.setrecursionlimit(5000)
|
|
|
|
|
2019-06-06 18:25:46 +02:00
|
|
|
# If extensions (or modules to document with autodoc) are in another directory,
|
|
|
|
# add these directories to sys.path here. If the directory is relative to the
|
|
|
|
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
2024-06-07 11:43:43 +03:00
|
|
|
SRC_DIR = os.path.abspath(os.path.dirname(__file__))
|
|
|
|
sys.path.append(SRC_DIR)
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2024-06-07 11:43:43 +03:00
|
|
|
import api2doc # noqa # pylint: disable=wrong-import-position
|
2019-06-06 18:25:46 +02:00
|
|
|
|
|
|
|
# -- Project information -----------------------------------------------------
|
|
|
|
|
2019-07-15 08:32:02 +02:00
|
|
|
project = 'Kea'
|
2025-01-28 10:06:26 +01:00
|
|
|
copyright = '2019-2025, Internet Systems Consortium' # pylint: disable=redefined-builtin
|
2019-06-06 18:25:46 +02:00
|
|
|
author = 'Internet Systems Consortium'
|
|
|
|
|
2019-07-19 08:11:34 +02:00
|
|
|
# get current kea version
|
2025-04-03 11:41:40 +03:00
|
|
|
meson_build_path = '../../meson.build'
|
2021-04-01 16:16:42 +03:00
|
|
|
changelog_path = '../../ChangeLog'
|
2025-04-03 11:41:40 +03:00
|
|
|
with open(meson_build_path, encoding='utf-8') as f:
|
|
|
|
version = None
|
2019-07-19 08:11:34 +02:00
|
|
|
for line in f.readlines():
|
2025-04-03 11:41:40 +03:00
|
|
|
m = re.search(r"version: '([0-9.]+)(|-git)',", line)
|
|
|
|
if m is not None:
|
|
|
|
version = m.group(1)
|
2021-04-01 16:16:42 +03:00
|
|
|
break
|
2025-04-03 11:41:40 +03:00
|
|
|
if version is None:
|
|
|
|
print('ERROR: Cannot determine Kea version from meson.build.')
|
|
|
|
sys.exit(1)
|
|
|
|
release = version
|
|
|
|
|
|
|
|
# If the first line of the ChangeLog announces release, it means
|
|
|
|
# that this is the final release.
|
|
|
|
dash_parts = version.split('-')
|
|
|
|
candidate_release = dash_parts[0]
|
|
|
|
with open(changelog_path, encoding='utf-8') as changelog_file:
|
|
|
|
first_line = changelog_file.readline()
|
|
|
|
if candidate_release in first_line and "released" in first_line:
|
|
|
|
version = candidate_release
|
|
|
|
|
|
|
|
cloudsmith_series = '-'.join(version.split('.')[0:2])
|
2019-07-19 08:11:34 +02:00
|
|
|
|
2024-05-24 08:13:35 +00:00
|
|
|
# now let's replace versions with odd minor number with dev
|
2025-04-03 11:41:40 +03:00
|
|
|
if int(cloudsmith_series[-1]) % 2 != 0:
|
|
|
|
cloudsmith_series = 'dev'
|
2024-05-24 08:13:35 +00:00
|
|
|
|
2019-06-06 18:25:46 +02:00
|
|
|
# -- General configuration ---------------------------------------------------
|
|
|
|
|
|
|
|
# If your documentation needs a minimal Sphinx version, state it here.
|
|
|
|
#
|
|
|
|
# needs_sphinx = '1.0'
|
|
|
|
|
|
|
|
# Add any Sphinx extension module names here, as strings. They can be
|
|
|
|
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
|
|
|
# ones.
|
|
|
|
extensions = [
|
|
|
|
'sphinx.ext.todo',
|
2020-08-04 12:33:59 +02:00
|
|
|
'sphinx.ext.mathjax',
|
2019-06-06 18:25:46 +02:00
|
|
|
]
|
|
|
|
|
|
|
|
# The suffix(es) of source filenames.
|
|
|
|
# You can specify multiple suffix as a list of string:
|
|
|
|
#
|
|
|
|
# source_suffix = ['.rst', '.md']
|
|
|
|
source_suffix = '.rst'
|
|
|
|
|
|
|
|
# The master toctree document.
|
2019-07-18 14:37:52 +02:00
|
|
|
master_doc = 'index'
|
2019-07-16 18:40:50 +02:00
|
|
|
|
|
|
|
# Additional docs
|
|
|
|
messages_doc = 'kea-messages'
|
2019-06-06 18:25:46 +02:00
|
|
|
|
|
|
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
|
|
|
# for a list of supported languages.
|
|
|
|
#
|
|
|
|
# This is also used if you do content translation via gettext catalogs.
|
|
|
|
# Usually you set "language" from the command line for these cases.
|
2022-06-27 18:21:06 +02:00
|
|
|
language = "en"
|
2019-06-06 18:25:46 +02:00
|
|
|
|
|
|
|
# List of patterns, relative to source directory, that match files and
|
|
|
|
# directories to ignore when looking for source files.
|
|
|
|
# This pattern also affects html_static_path and html_extra_path.
|
2019-07-19 09:41:56 +02:00
|
|
|
exclude_patterns = [
|
|
|
|
'_build', 'Thumbs.db', '.DS_Store',
|
|
|
|
# included files need to be excluded to avoid duplicate labels
|
2020-03-18 16:19:08 +01:00
|
|
|
'arm/platforms.rst',
|
2019-11-21 10:59:59 +01:00
|
|
|
'arm/hooks-bootp.rst',
|
2019-07-19 09:41:56 +02:00
|
|
|
'arm/hooks-class-cmds.rst',
|
|
|
|
'arm/hooks-cb-cmds.rst',
|
2019-07-19 12:37:54 +02:00
|
|
|
'arm/config-backend.rst',
|
2019-07-19 09:41:56 +02:00
|
|
|
'arm/hooks-ha.rst',
|
|
|
|
'arm/hooks-host-cache.rst',
|
|
|
|
'arm/hooks-lease-cmds.rst',
|
2020-05-21 00:07:09 +02:00
|
|
|
'arm/hooks-lease-query.rst',
|
2022-05-06 08:56:07 +03:00
|
|
|
'arm/hooks-limits.rst',
|
2024-02-06 10:40:27 -05:00
|
|
|
'arm/hooks-perfmon.rst',
|
2023-08-17 14:58:34 -04:00
|
|
|
'arm/hooks-ping-check.rst',
|
2019-07-19 09:41:56 +02:00
|
|
|
'arm/hooks-radius.rst',
|
2022-05-13 18:33:04 +02:00
|
|
|
'arm/hooks-rbac.rst',
|
2021-02-15 15:45:33 +02:00
|
|
|
'arm/hooks-run-script.rst',
|
2019-07-19 09:41:56 +02:00
|
|
|
'arm/hooks-stat-cmds.rst',
|
2022-04-25 11:56:41 +00:00
|
|
|
'arm/hooks-ddns-tuning.rst',
|
2019-07-19 09:41:56 +02:00
|
|
|
'arm/hammer.rst',
|
2021-08-19 11:20:57 +02:00
|
|
|
'arm/ext-netconf.rst',
|
|
|
|
'arm/ext-gss-tsig.rst',
|
2023-11-08 17:21:29 +02:00
|
|
|
'arm/ext-radius.rst',
|
2021-06-23 17:32:50 +03:00
|
|
|
'grammar/grammar-ca-parser.rst',
|
|
|
|
'grammar/grammar-d2-parser.rst',
|
|
|
|
'grammar/grammar-dhcp4-parser.rst',
|
|
|
|
'grammar/grammar-dhcp6-parser.rst',
|
|
|
|
'grammar/grammar-netconf-parser.rst',
|
2022-05-11 22:05:43 +00:00
|
|
|
'arm/hooks-flex-id.rst',
|
|
|
|
'arm/hooks-flex-option.rst',
|
|
|
|
'arm/hooks-legal-log.rst',
|
|
|
|
'arm/hooks-gss-tsig.rst',
|
|
|
|
'arm/hooks-host-cmds.rst',
|
2024-10-04 18:13:17 +03:00
|
|
|
'arm/hooks-mysql.rst',
|
|
|
|
'arm/hooks-pgsql.rst',
|
2022-05-11 22:05:43 +00:00
|
|
|
'arm/hooks-limits.rst',
|
|
|
|
'arm/hooks-rbac.rst',
|
|
|
|
'arm/hooks-run-script.rst',
|
|
|
|
'arm/hooks-subnet-cmds.rst',
|
|
|
|
'arm/hooks-user-chk.rst',
|
2019-07-19 09:41:56 +02:00
|
|
|
]
|
2019-06-06 18:25:46 +02:00
|
|
|
|
2023-11-13 09:16:28 +02:00
|
|
|
# Report broken references.
|
|
|
|
nitpicky = True
|
|
|
|
|
2022-07-27 15:11:40 +03:00
|
|
|
# Leave quotes and dashes unchanged and don't convert them to typographically
|
|
|
|
# correct entities.
|
|
|
|
smartquotes = False
|
|
|
|
|
2019-06-06 18:25:46 +02:00
|
|
|
# The name of the Pygments (syntax highlighting) style to use.
|
|
|
|
pygments_style = None
|
|
|
|
|
|
|
|
|
|
|
|
# -- Options for HTML output -------------------------------------------------
|
|
|
|
|
|
|
|
# The theme to use for HTML and HTML Help pages. See the documentation for
|
|
|
|
# a list of builtin themes.
|
|
|
|
#
|
2024-06-06 15:41:10 +03:00
|
|
|
# html_theme = 'alabaster'
|
2019-07-15 08:32:02 +02:00
|
|
|
html_theme = 'sphinx_rtd_theme'
|
2019-07-17 15:42:19 +02:00
|
|
|
html_logo = 'static/kea-imageonly-100bw.png'
|
2019-06-06 18:25:46 +02:00
|
|
|
|
|
|
|
# Theme options are theme-specific and customize the look and feel of a theme
|
|
|
|
# further. For a list of options available for each theme, see the
|
|
|
|
# documentation.
|
|
|
|
#
|
2024-06-06 15:41:10 +03:00
|
|
|
# html_theme_options = {
|
|
|
|
# "logo": "kea-logo-100x70.png",
|
|
|
|
# }
|
2019-06-06 18:25:46 +02:00
|
|
|
|
|
|
|
# Add any paths that contain custom static files (such as style sheets) here,
|
|
|
|
# relative to this directory. They are copied after the builtin static files,
|
|
|
|
# so a file named "default.css" will overwrite the builtin "default.css".
|
2019-07-17 15:42:19 +02:00
|
|
|
html_static_path = ['static']
|
2019-06-06 18:25:46 +02:00
|
|
|
|
|
|
|
# Custom sidebar templates, must be a dictionary that maps document names
|
|
|
|
# to template names.
|
|
|
|
#
|
|
|
|
# The default sidebars (for documents that don't match any pattern) are
|
|
|
|
# defined by theme itself. Builtin themes are using these templates by
|
|
|
|
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
|
|
|
|
# 'searchbox.html']``.
|
|
|
|
#
|
|
|
|
# html_sidebars = {}
|
|
|
|
|
|
|
|
|
|
|
|
# -- Options for HTMLHelp output ---------------------------------------------
|
|
|
|
|
|
|
|
# Output file base name for HTML help builder.
|
2024-06-06 15:41:10 +03:00
|
|
|
# htmlhelp_basename = 'KeaAdministratorReferenceManualdoc'
|
2019-06-06 18:25:46 +02:00
|
|
|
|
|
|
|
|
|
|
|
# -- Options for LaTeX output ------------------------------------------------
|
|
|
|
|
|
|
|
latex_elements = {
|
|
|
|
# The paper size ('letterpaper' or 'a4paper').
|
|
|
|
#
|
|
|
|
# 'papersize': 'letterpaper',
|
|
|
|
|
|
|
|
# The font size ('10pt', '11pt' or '12pt').
|
|
|
|
#
|
|
|
|
# 'pointsize': '10pt',
|
|
|
|
|
|
|
|
# Additional stuff for the LaTeX preamble.
|
|
|
|
#
|
|
|
|
# 'preamble': '',
|
|
|
|
|
|
|
|
# Latex figure (float) alignment
|
|
|
|
#
|
|
|
|
# 'figure_align': 'htbp',
|
|
|
|
}
|
|
|
|
|
|
|
|
# Grouping the document tree into LaTeX files. List of tuples
|
|
|
|
# (source start file, target name, title,
|
|
|
|
# author, documentclass [howto, manual, or own class]).
|
|
|
|
latex_documents = [
|
2019-07-17 15:42:19 +02:00
|
|
|
(master_doc, 'kea-arm.tex', 'Kea Administrator Reference Manual Documentation', author, 'manual'),
|
2019-06-06 18:25:46 +02:00
|
|
|
]
|
|
|
|
|
2021-08-03 15:33:51 +03:00
|
|
|
latex_logo = 'static/kea-logo-200.png'
|
|
|
|
|
2019-08-13 15:09:52 +02:00
|
|
|
if os.getenv("READTHEDOCS", "False") == "False":
|
2019-08-13 15:02:50 +02:00
|
|
|
latex_documents.append((messages_doc, 'kea-messages.tex', 'Kea Messages Manual', author, 'manual'))
|
|
|
|
|
2019-06-06 18:25:46 +02:00
|
|
|
|
|
|
|
# -- Options for manual page output ------------------------------------------
|
|
|
|
|
|
|
|
# One entry per manual page. List of tuples
|
|
|
|
# (source start file, name, description, authors, manual section).
|
|
|
|
man_pages = [
|
2019-07-17 15:42:19 +02:00
|
|
|
(master_doc, 'kea-arm', 'Kea Administrator Reference Manual Documentation', [author], 1),
|
|
|
|
('man/kea-admin.8', 'kea-admin', 'Shell script for managing Kea databases', author, 8),
|
|
|
|
('man/keactrl.8', 'keactrl', 'Shell script for managing Kea', author, 8),
|
|
|
|
('man/kea-ctrl-agent.8', 'kea-ctrl-agent', 'Control Agent process in Kea', author, 8),
|
|
|
|
('man/kea-dhcp4.8', 'kea-dhcp4', 'DHCPv4 server in Kea', author, 8),
|
|
|
|
('man/kea-dhcp6.8', 'kea-dhcp6', 'DHCPv6 server in Kea', author, 8),
|
|
|
|
('man/kea-dhcp-ddns.8', 'kea-dhcp-ddns', 'DHCP-DDNS process in Kea', author, 8),
|
|
|
|
('man/kea-lfc.8', 'kea-lfc', 'Lease File Cleanup process in Kea', author, 8),
|
2021-07-16 14:34:18 +03:00
|
|
|
('man/kea-netconf.8', 'kea-netconf', 'NETCONF agent for configuring Kea', author, 8),
|
2019-07-17 15:42:19 +02:00
|
|
|
('man/kea-shell.8', 'kea-shell', 'Text client for Control Agent process', author, 8),
|
|
|
|
('man/perfdhcp.8', 'perfdhcp', 'DHCP benchmarking tool', author, 8),
|
2019-06-06 18:25:46 +02:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
# -- Extension configuration -------------------------------------------------
|
|
|
|
|
|
|
|
# -- Options for todo extension ----------------------------------------------
|
|
|
|
|
|
|
|
# If true, `todo` and `todoList` produce output, else they produce nothing.
|
|
|
|
todo_include_todos = True
|
2019-07-15 08:32:02 +02:00
|
|
|
|
2023-10-10 18:23:10 +03:00
|
|
|
# -- Substitutions -----------------------------------------------------------
|
2019-07-15 08:32:02 +02:00
|
|
|
|
2024-06-06 15:41:10 +03:00
|
|
|
rst_prolog = """
|
2025-04-03 11:41:40 +03:00
|
|
|
.. |cloudsmith_repo| replace:: kea-{cloudsmith_series}
|
|
|
|
""".format(cloudsmith_series=cloudsmith_series)
|
2023-10-10 18:23:10 +03:00
|
|
|
|
2024-06-06 15:41:10 +03:00
|
|
|
|
2023-10-10 18:23:10 +03:00
|
|
|
# -- Functions ---------------------------------------------------------------
|
2019-08-09 13:10:53 +02:00
|
|
|
|
2025-04-03 11:41:40 +03:00
|
|
|
# Do generation of api.rst and kea-messages.rst here in conf.py instead of meson.build
|
2019-08-09 13:10:53 +02:00
|
|
|
# so they are available on ReadTheDocs as there makefiles are not used for building docs.
|
|
|
|
def run_generate_docs(_):
|
2024-06-07 11:43:43 +03:00
|
|
|
with open(os.path.join(SRC_DIR, 'api-files.txt'), encoding='utf-8') as af:
|
2019-08-12 17:46:51 +02:00
|
|
|
api_files = af.read().split()
|
2024-06-07 11:43:43 +03:00
|
|
|
api_files = [os.path.abspath(os.path.join(SRC_DIR, '../..', af)) for af in api_files]
|
|
|
|
api2doc.generate(api_files, os.path.join(SRC_DIR, 'api.rst'))
|
2019-08-09 13:10:53 +02:00
|
|
|
|
2020-03-20 13:56:41 +01:00
|
|
|
# Sphinx has some limitations. It can't import files from outside its directory, which
|
|
|
|
# in our case is src/sphinx. On the other hand, we need to have platforms.rst file
|
|
|
|
# in top level directory, so it's easily accessible by prospective and first time
|
2020-03-20 14:51:43 +01:00
|
|
|
# users. Furthermore, ReadTheDocs does not use the makefile system at all and they rely
|
2025-04-03 11:41:40 +03:00
|
|
|
# on sphinx-build only. As a result we need to conduct some Meson-like operations
|
2020-03-20 13:56:41 +01:00
|
|
|
# here. This requires us to copy (or link) the file from the top level to sphinx subdir.
|
2021-09-23 15:25:49 +02:00
|
|
|
#
|
|
|
|
# The first entry on this list is the actual file to copy, the second is a unique name
|
|
|
|
# that will be used when copied over to arm/ directory.
|
|
|
|
FILES_TO_COPY = [
|
2024-06-06 15:41:10 +03:00
|
|
|
['../../platforms.rst', 'platforms.rst'],
|
|
|
|
['../examples/template-power-user-home/info.md', 'template-power-user-home.md'],
|
|
|
|
['../examples/template-power-user-home/kea-ca-1.conf', 'template-power-user-home-ca-1.conf'],
|
|
|
|
['../examples/template-power-user-home/kea-ca-2.conf', 'template-power-user-home-ca-2.conf'],
|
|
|
|
['../examples/template-power-user-home/kea-dhcp4-1.conf', 'template-power-user-home-dhcp4-1.conf'],
|
|
|
|
['../examples/template-power-user-home/kea-dhcp4-2.conf', 'template-power-user-home-dhcp4-2.conf'],
|
|
|
|
['../examples/template-ha-mt-tls/info.md', 'template-ha-mt-tls.md'],
|
|
|
|
['../examples/template-ha-mt-tls/kea-ca-1.conf', 'template-ha-mt-tls-ca-1.conf'],
|
|
|
|
['../examples/template-ha-mt-tls/kea-ca-2.conf', 'template-ha-mt-tls-ca-2.conf'],
|
|
|
|
['../examples/template-ha-mt-tls/kea-dhcp4-1.conf', 'template-ha-mt-tls-dhcp4-1.conf'],
|
|
|
|
['../examples/template-ha-mt-tls/kea-dhcp4-2.conf', 'template-ha-mt-tls-dhcp4-2.conf']
|
2021-09-23 15:25:49 +02:00
|
|
|
]
|
|
|
|
|
|
|
|
for [a, b] in FILES_TO_COPY:
|
2024-06-07 11:43:43 +03:00
|
|
|
src = os.path.join(SRC_DIR, a)
|
|
|
|
dst = os.path.join(SRC_DIR, 'arm', b)
|
2021-09-23 15:25:49 +02:00
|
|
|
print("Copying %s to %s" % (src, dst))
|
|
|
|
copyfile(src, dst)
|
2019-08-09 13:10:53 +02:00
|
|
|
|
2024-06-06 15:41:10 +03:00
|
|
|
|
2019-07-15 08:32:02 +02:00
|
|
|
# custom setup hook
|
|
|
|
def setup(app):
|
2023-06-06 12:02:05 +03:00
|
|
|
app.add_crossref_type('isccmd', 'isccmd')
|
2023-06-06 12:32:54 +03:00
|
|
|
app.add_crossref_type('ischooklib', 'ischooklib')
|
2023-05-31 15:12:51 +03:00
|
|
|
app.add_crossref_type('iscman', 'iscman')
|
2021-05-19 12:10:25 +03:00
|
|
|
if hasattr(app, 'add_css_file'):
|
|
|
|
app.add_css_file('kea.css')
|
|
|
|
else:
|
|
|
|
app.add_stylesheet('kea.css')
|
2019-08-09 13:10:53 +02:00
|
|
|
|
|
|
|
app.connect('builder-inited', run_generate_docs)
|