2012-10-15 14:26:11 -06:00
|
|
|
# pylint: disable=C0103,W0622
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2012-10-15 14:26:11 -06:00
|
|
|
Sphinx documentation for Salt
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2012-01-15 22:33:44 -07:00
|
|
|
import os
|
2023-11-16 11:25:04 +00:00
|
|
|
import pathlib
|
2018-06-06 20:19:44 -05:00
|
|
|
import re
|
2023-11-16 11:25:04 +00:00
|
|
|
import shutil
|
2012-05-29 16:17:03 -07:00
|
|
|
import sys
|
2023-11-16 11:25:04 +00:00
|
|
|
import textwrap
|
2016-06-13 09:24:40 -06:00
|
|
|
import time
|
2012-06-19 13:39:33 +05:30
|
|
|
import types
|
2011-05-23 14:51:31 +08:00
|
|
|
|
2020-04-16 14:34:26 -06:00
|
|
|
from sphinx.directives.other import TocTree
|
2023-11-16 11:25:04 +00:00
|
|
|
from sphinx.util import logging
|
|
|
|
|
|
|
|
log = logging.getLogger(__name__)
|
2012-06-19 13:39:33 +05:30
|
|
|
|
2012-01-15 22:33:44 -07:00
|
|
|
# -- Add paths to PYTHONPATH ---------------------------------------------------
|
2013-10-11 23:23:17 +01:00
|
|
|
try:
|
|
|
|
docs_basepath = os.path.abspath(os.path.dirname(__file__))
|
|
|
|
except NameError:
|
|
|
|
# sphinx-intl and six execute some code which will raise this NameError
|
|
|
|
# assume we're in the doc/ directory
|
|
|
|
docs_basepath = os.path.abspath(os.path.dirname("."))
|
2012-01-15 22:33:44 -07:00
|
|
|
|
2012-01-10 06:10:34 -07:00
|
|
|
addtl_paths = (
|
2018-12-19 12:24:45 +01:00
|
|
|
os.pardir, # salt itself (for autodoc)
|
|
|
|
"_ext", # custom Sphinx extensions
|
2012-01-10 06:10:34 -07:00
|
|
|
)
|
2011-05-23 14:51:31 +08:00
|
|
|
|
2018-12-19 12:24:45 +01:00
|
|
|
for addtl_path in addtl_paths:
|
2021-02-25 10:02:58 +00:00
|
|
|
path = os.path.abspath(os.path.join(docs_basepath, addtl_path))
|
|
|
|
sys.path.insert(0, path)
|
2011-05-23 14:51:31 +08:00
|
|
|
|
2013-10-11 23:23:17 +01:00
|
|
|
# We're now able to import salt
|
2013-07-15 15:09:13 -06:00
|
|
|
import salt.version # isort:skip
|
2011-09-25 00:30:36 -06:00
|
|
|
|
2013-09-11 00:36:22 -06:00
|
|
|
formulas_dir = os.path.join(os.pardir, docs_basepath, "formulas")
|
2012-01-16 02:14:22 -07:00
|
|
|
|
2013-07-23 16:39:55 +01:00
|
|
|
# ----- Intersphinx Settings ------------------------------------------------>
|
2021-11-30 10:22:06 +01:00
|
|
|
intersphinx_mapping = {
|
|
|
|
"python": (
|
|
|
|
"https://docs.python.org/3",
|
|
|
|
(
|
|
|
|
"/usr/share/doc/python{}.{}/html/objects.inv".format(
|
|
|
|
sys.version_info[0], sys.version_info[1]
|
|
|
|
),
|
|
|
|
"/usr/share/doc/python/html/objects.inv",
|
|
|
|
None,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
}
|
2013-07-23 16:39:55 +01:00
|
|
|
# <---- Intersphinx Settings -------------------------------------------------
|
|
|
|
|
2013-10-29 09:13:07 +01:00
|
|
|
# -- General Configuration -----------------------------------------------------
|
2011-05-23 14:51:31 +08:00
|
|
|
|
2016-08-31 09:51:36 -06:00
|
|
|
# Set a var if we're building docs for the live site or not
|
|
|
|
on_saltstack = "SALT_ON_SALTSTACK" in os.environ
|
|
|
|
|
2012-06-04 16:40:34 -06:00
|
|
|
project = "Salt"
|
2021-03-17 06:31:23 +00:00
|
|
|
# This is the default branch on GitHub for the Salt project
|
|
|
|
repo_primary_branch = "master"
|
2023-02-17 05:31:13 +00:00
|
|
|
if "LATEST_RELEASE" not in os.environ:
|
|
|
|
salt_version = salt.version.__saltstack_version__
|
|
|
|
else:
|
|
|
|
salt_version = salt.version.SaltStackVersion.parse(os.environ["LATEST_RELEASE"])
|
|
|
|
|
|
|
|
major_version = str(salt_version.major)
|
|
|
|
latest_release = ".".join([str(x) for x in salt_version.info])
|
2020-01-17 10:01:34 -07:00
|
|
|
previous_release = os.environ.get(
|
|
|
|
"PREVIOUS_RELEASE", "previous_release"
|
2021-03-17 06:31:23 +00:00
|
|
|
) # latest release from previous branch (3002.5)
|
2020-01-17 10:01:34 -07:00
|
|
|
previous_release_dir = os.environ.get(
|
|
|
|
"PREVIOUS_RELEASE_DIR", "previous_release_dir"
|
2021-03-17 06:31:23 +00:00
|
|
|
) # path on web server for previous branch (3002.5)
|
2016-11-28 10:10:00 -07:00
|
|
|
next_release = "" # next release
|
|
|
|
next_release_dir = "" # path on web server for next release branch
|
2020-04-02 20:10:20 -05:00
|
|
|
|
2021-03-17 17:09:50 -05:00
|
|
|
# Sphinx variable
|
|
|
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-version
|
|
|
|
version = latest_release
|
|
|
|
|
2016-08-31 09:51:36 -06:00
|
|
|
today = ""
|
|
|
|
copyright = ""
|
|
|
|
if on_saltstack:
|
2020-12-10 07:31:27 +00:00
|
|
|
today = "Generated on {} at {}.".format(
|
|
|
|
time.strftime("%B %d, %Y"), time.strftime("%X %Z")
|
2020-04-02 20:10:20 -05:00
|
|
|
)
|
2016-08-31 09:51:36 -06:00
|
|
|
copyright = time.strftime("%Y")
|
2016-06-13 09:24:40 -06:00
|
|
|
|
2016-05-25 18:09:37 -06:00
|
|
|
# < --- START do not merge these settings to other branches START ---> #
|
2020-01-17 10:01:34 -07:00
|
|
|
build_type = os.environ.get(
|
|
|
|
"BUILD_TYPE", repo_primary_branch
|
|
|
|
) # latest, previous, master, next
|
2016-05-25 18:09:37 -06:00
|
|
|
# < --- END do not merge these settings to other branches END ---> #
|
2015-05-22 11:53:33 -06:00
|
|
|
|
|
|
|
# Set google custom search engine
|
|
|
|
|
2019-10-22 15:59:27 -06:00
|
|
|
if build_type == repo_primary_branch:
|
|
|
|
release = latest_release
|
|
|
|
search_cx = "011515552685726825874:v1had6i279q" # master
|
|
|
|
# search_cx = '011515552685726825874:x17j5zl74g8' # develop
|
|
|
|
elif build_type == "next":
|
|
|
|
release = next_release
|
|
|
|
search_cx = "011515552685726825874:ht0p8miksrm" # latest
|
|
|
|
elif build_type == "previous":
|
|
|
|
release = previous_release
|
2021-08-30 11:22:08 -05:00
|
|
|
if release.startswith("3006"):
|
|
|
|
search_cx = "2e4374de8af93a7b1" # 3006
|
|
|
|
elif release.startswith("3005"):
|
|
|
|
search_cx = "57b1006b37edd9e79" # 3005
|
|
|
|
elif release.startswith("3004"):
|
|
|
|
search_cx = "23cd7068705804111" # 3004
|
|
|
|
elif release.startswith("3003"):
|
2020-09-09 23:32:02 +00:00
|
|
|
search_cx = "a70a1a73eef62aecd" # 3003
|
|
|
|
elif release.startswith("3002"):
|
|
|
|
search_cx = "5026f4f2af0bdbe2d" # 3002
|
|
|
|
elif release.startswith("3001"):
|
|
|
|
search_cx = "f0e4f298fa32b8a5e" # 3001
|
|
|
|
elif release.startswith("3000"):
|
2020-01-17 10:01:34 -07:00
|
|
|
search_cx = "011515552685726825874:3skhaozjtyn" # 3000
|
|
|
|
elif release.startswith("2019.2"):
|
|
|
|
search_cx = "011515552685726825874:huvjhlpptnm" # 2019.2
|
|
|
|
elif release.startswith("2018.3"):
|
2019-10-22 15:59:27 -06:00
|
|
|
search_cx = "011515552685726825874:vadptdpvyyu" # 2018.3
|
|
|
|
elif release.startswith("2017.7"):
|
|
|
|
search_cx = "011515552685726825874:w-hxmnbcpou" # 2017.7
|
|
|
|
elif release.startswith("2016.11"):
|
|
|
|
search_cx = "011515552685726825874:dlsj745pvhq" # 2016.11
|
|
|
|
else:
|
|
|
|
search_cx = "011515552685726825874:ht0p8miksrm" # latest
|
|
|
|
else: # latest or something else
|
|
|
|
release = latest_release
|
2018-10-25 16:10:15 -04:00
|
|
|
search_cx = "011515552685726825874:ht0p8miksrm" # latest
|
2011-05-23 14:51:31 +08:00
|
|
|
|
2014-12-19 13:46:02 -07:00
|
|
|
needs_sphinx = "1.3"
|
|
|
|
|
2014-07-13 13:43:33 -05:00
|
|
|
spelling_lang = "en_US"
|
2023-02-17 05:33:07 +00:00
|
|
|
spelling_show_suggestions = True
|
2013-09-11 22:23:46 -06:00
|
|
|
language = "en"
|
|
|
|
locale_dirs = [
|
|
|
|
"_locale",
|
|
|
|
]
|
|
|
|
|
2011-10-10 19:31:51 -06:00
|
|
|
master_doc = "contents"
|
2011-10-10 19:23:39 -06:00
|
|
|
templates_path = ["_templates"]
|
2013-08-20 23:43:54 +01:00
|
|
|
exclude_patterns = ["_build", "_incl/*", "ref/cli/_includes/*.rst"]
|
2011-05-23 14:51:31 +08:00
|
|
|
|
2012-10-15 14:26:11 -06:00
|
|
|
extensions = [
|
2013-12-13 22:33:50 -07:00
|
|
|
"saltdomain", # Must come early
|
2012-10-15 14:26:11 -06:00
|
|
|
"sphinx.ext.autodoc",
|
2016-10-12 09:31:07 -06:00
|
|
|
"sphinx.ext.napoleon",
|
2012-10-15 14:26:11 -06:00
|
|
|
"sphinx.ext.autosummary",
|
|
|
|
"sphinx.ext.extlinks",
|
2021-02-06 02:57:10 +00:00
|
|
|
"sphinx.ext.imgconverter",
|
2013-09-17 17:53:29 -06:00
|
|
|
"sphinx.ext.intersphinx",
|
2023-02-17 05:31:13 +00:00
|
|
|
"sphinxcontrib.httpdomain",
|
2023-02-13 18:22:31 +00:00
|
|
|
"saltrepo",
|
|
|
|
"myst_parser",
|
2023-02-17 05:33:07 +00:00
|
|
|
"sphinxcontrib.spelling",
|
2018-11-13 13:05:55 -06:00
|
|
|
#'saltautodoc', # Must be AFTER autodoc
|
2012-10-15 14:26:11 -06:00
|
|
|
]
|
2011-05-23 14:51:31 +08:00
|
|
|
|
2011-10-10 19:23:39 -06:00
|
|
|
modindex_common_prefix = ["salt."]
|
2011-05-23 14:51:31 +08:00
|
|
|
|
2011-11-07 00:47:06 -07:00
|
|
|
autosummary_generate = True
|
2020-06-05 16:04:05 -06:00
|
|
|
autosummary_generate_overwrite = False
|
2011-11-07 00:47:06 -07:00
|
|
|
|
2021-02-25 10:02:58 +00:00
|
|
|
# In case building docs throws import errors, please add the top level package name below
|
2023-02-17 05:31:13 +00:00
|
|
|
autodoc_mock_imports = []
|
2021-02-25 10:02:58 +00:00
|
|
|
|
2018-06-06 20:19:44 -05:00
|
|
|
# strip git rev as there won't necessarily be a release based on it
|
|
|
|
stripped_release = re.sub(r"-\d+-g[0-9a-f]+$", "", release)
|
|
|
|
|
2011-10-10 19:23:39 -06:00
|
|
|
# Define a substitution for linking to the latest release tarball
|
|
|
|
rst_prolog = """\
|
2015-03-10 22:06:59 -04:00
|
|
|
.. |current_release_doc| replace:: :doc:`/topics/releases/{release}`
|
2011-11-15 22:41:20 -07:00
|
|
|
.. |saltrepo| replace:: https://github.com/saltstack/salt
|
2014-07-14 14:54:36 -06:00
|
|
|
.. _`salt-users`: https://groups.google.com/forum/#!forum/salt-users
|
|
|
|
.. _`salt-announce`: https://groups.google.com/forum/#!forum/salt-announce
|
|
|
|
.. _`salt-packagers`: https://groups.google.com/forum/#!forum/salt-packagers
|
2024-07-31 23:32:52 +07:00
|
|
|
.. _`salt-discord`: https://discord.com/invite/J7b7EscrAs
|
2015-08-05 15:13:19 -06:00
|
|
|
|
2019-10-25 18:28:53 +01:00
|
|
|
""".format(
|
|
|
|
release=stripped_release
|
|
|
|
)
|
2011-05-23 14:51:31 +08:00
|
|
|
|
2011-09-25 00:36:41 -06:00
|
|
|
# A shortcut for linking to tickets on the GitHub issue tracker
|
|
|
|
extlinks = {
|
2019-10-22 15:59:27 -06:00
|
|
|
"blob": (
|
|
|
|
"https://github.com/saltstack/salt/blob/%s/%%s" % repo_primary_branch,
|
2023-01-24 22:14:48 -07:00
|
|
|
"%s",
|
2019-10-22 15:59:27 -06:00
|
|
|
),
|
2023-01-24 22:14:48 -07:00
|
|
|
"issue": ("https://github.com/saltstack/salt/issues/%s", "issue %s"),
|
|
|
|
"pull": ("https://github.com/saltstack/salt/pull/%s", "PR %s"),
|
|
|
|
"formula_url": ("https://github.com/saltstack-formulas/%s", "url %s"),
|
2011-09-25 00:36:41 -06:00
|
|
|
}
|
2011-05-23 14:51:31 +08:00
|
|
|
|
2023-02-13 18:22:31 +00:00
|
|
|
myst_gfm_only = True
|
2011-05-23 14:51:31 +08:00
|
|
|
|
2013-10-11 23:23:17 +01:00
|
|
|
# ----- Localization -------------------------------------------------------->
|
|
|
|
locale_dirs = ["locale/"]
|
|
|
|
gettext_compact = False
|
|
|
|
# <---- Localization ---------------------------------------------------------
|
2012-01-16 02:14:22 -07:00
|
|
|
|
2014-04-16 23:58:58 -06:00
|
|
|
|
|
|
|
### HTML options
|
2018-12-19 12:24:45 +01:00
|
|
|
# set 'HTML_THEME=saltstack' to use previous theme
|
|
|
|
html_theme = os.environ.get("HTML_THEME", "saltstack2")
|
2013-02-22 02:59:37 -07:00
|
|
|
html_theme_path = ["_themes"]
|
2020-07-30 16:51:03 -05:00
|
|
|
html_title = ""
|
2011-10-10 19:23:39 -06:00
|
|
|
html_short_title = "Salt"
|
2020-04-02 20:10:20 -05:00
|
|
|
|
2011-10-10 19:31:51 -06:00
|
|
|
html_static_path = ["_static"]
|
2014-12-08 14:32:53 -08:00
|
|
|
html_logo = None # specified in the theme layout.html
|
2011-10-16 23:54:11 -06:00
|
|
|
html_favicon = "favicon.ico"
|
2019-09-18 16:49:11 -07:00
|
|
|
smartquotes = False
|
2011-05-23 14:51:31 +08:00
|
|
|
|
2014-04-16 23:59:40 -06:00
|
|
|
# Use Google customized search or use Sphinx built-in JavaScript search
|
2014-04-29 17:08:16 -06:00
|
|
|
if on_saltstack:
|
2014-04-16 23:59:40 -06:00
|
|
|
html_search_template = "googlesearch.html"
|
|
|
|
else:
|
|
|
|
html_search_template = "searchbox.html"
|
|
|
|
|
2011-11-16 19:52:51 -07:00
|
|
|
html_additional_pages = {
|
|
|
|
"404": "404.html",
|
|
|
|
}
|
2011-11-13 04:44:15 -07:00
|
|
|
|
2013-02-28 10:09:11 -07:00
|
|
|
html_default_sidebars = [
|
2014-04-29 16:58:36 -06:00
|
|
|
html_search_template,
|
2014-04-29 16:21:25 -06:00
|
|
|
"version.html",
|
2013-02-28 10:09:11 -07:00
|
|
|
"localtoc.html",
|
|
|
|
"relations.html",
|
|
|
|
"sourcelink.html",
|
2014-04-29 17:49:00 -06:00
|
|
|
"saltstack.html",
|
2013-02-28 10:09:11 -07:00
|
|
|
]
|
2011-11-13 04:44:15 -07:00
|
|
|
html_sidebars = {
|
2013-02-28 10:09:11 -07:00
|
|
|
"ref/**/all/salt.*": [
|
2014-04-29 16:58:36 -06:00
|
|
|
html_search_template,
|
2014-04-29 16:21:25 -06:00
|
|
|
"version.html",
|
2013-02-28 10:09:11 -07:00
|
|
|
"modules-sidebar.html",
|
2012-02-06 15:45:24 -07:00
|
|
|
"localtoc.html",
|
|
|
|
"relations.html",
|
|
|
|
"sourcelink.html",
|
2014-04-29 17:49:00 -06:00
|
|
|
"saltstack.html",
|
2013-09-11 08:46:58 -06:00
|
|
|
],
|
|
|
|
"ref/formula/all/*": [],
|
2011-11-13 04:44:15 -07:00
|
|
|
}
|
|
|
|
|
2011-10-10 19:31:51 -06:00
|
|
|
html_context = {
|
2014-04-29 17:08:16 -06:00
|
|
|
"on_saltstack": on_saltstack,
|
2013-02-28 10:42:26 -07:00
|
|
|
"html_default_sidebars": html_default_sidebars,
|
2011-11-15 22:41:20 -07:00
|
|
|
"github_base": "https://github.com/saltstack/salt",
|
|
|
|
"github_issues": "https://github.com/saltstack/salt/issues",
|
|
|
|
"github_downloads": "https://github.com/saltstack/salt/downloads",
|
2015-05-22 11:53:33 -06:00
|
|
|
"latest_release": latest_release,
|
|
|
|
"previous_release": previous_release,
|
|
|
|
"previous_release_dir": previous_release_dir,
|
2016-02-16 15:25:28 -07:00
|
|
|
"next_release": next_release,
|
|
|
|
"next_release_dir": next_release_dir,
|
2015-05-22 11:53:33 -06:00
|
|
|
"search_cx": search_cx,
|
|
|
|
"build_type": build_type,
|
2016-06-13 09:24:40 -06:00
|
|
|
"today": today,
|
2016-08-31 09:51:36 -06:00
|
|
|
"copyright": copyright,
|
2019-10-25 18:28:53 +01:00
|
|
|
"repo_primary_branch": repo_primary_branch,
|
2011-10-10 19:31:51 -06:00
|
|
|
}
|
2011-05-23 14:51:31 +08:00
|
|
|
|
2012-10-11 14:40:40 -06:00
|
|
|
html_use_index = True
|
2011-10-10 19:23:39 -06:00
|
|
|
html_last_updated_fmt = "%b %d, %Y"
|
|
|
|
html_show_sourcelink = False
|
|
|
|
html_show_sphinx = True
|
|
|
|
html_show_copyright = True
|
2011-05-23 14:51:31 +08:00
|
|
|
|
2011-10-10 19:23:39 -06:00
|
|
|
### Latex options
|
2014-11-26 16:21:18 -06:00
|
|
|
|
2011-05-23 14:51:31 +08:00
|
|
|
latex_documents = [
|
2022-03-16 16:57:22 +00:00
|
|
|
("contents", "Salt.tex", "Salt Documentation", "VMware, Inc.", "manual"),
|
2011-05-23 14:51:31 +08:00
|
|
|
]
|
|
|
|
|
2015-05-11 17:29:12 -06:00
|
|
|
latex_logo = "_static/salt-logo.png"
|
2011-05-23 14:51:31 +08:00
|
|
|
|
2014-06-04 17:40:31 -06:00
|
|
|
latex_elements = {
|
|
|
|
"inputenc": "", # use XeTeX instead of the inputenc LaTeX package.
|
|
|
|
"utf8extra": "",
|
2018-12-19 11:30:06 +01:00
|
|
|
"preamble": r"""
|
2015-05-19 15:54:28 -06:00
|
|
|
\usepackage{fontspec}
|
|
|
|
\setsansfont{Linux Biolinum O}
|
|
|
|
\setromanfont{Linux Libertine O}
|
|
|
|
\setmonofont{Source Code Pro}
|
2014-06-04 17:40:31 -06:00
|
|
|
""",
|
|
|
|
}
|
2015-05-19 15:54:28 -06:00
|
|
|
### Linux Biolinum, Linux Libertine: http://www.linuxlibertine.org/
|
|
|
|
### Source Code Pro: https://github.com/adobe-fonts/source-code-pro/releases
|
|
|
|
|
2014-06-04 17:40:31 -06:00
|
|
|
|
2014-02-20 16:16:59 -07:00
|
|
|
### Linkcheck options
|
2018-12-19 12:24:45 +01:00
|
|
|
linkcheck_ignore = [
|
|
|
|
r"http://127.0.0.1",
|
|
|
|
r"http://salt:\d+",
|
|
|
|
r"http://local:\d+",
|
|
|
|
r"https://console.aws.amazon.com",
|
|
|
|
r"http://192.168.33.10",
|
|
|
|
r"http://domain:\d+",
|
|
|
|
r"http://123.456.789.012:\d+",
|
|
|
|
r"http://localhost",
|
|
|
|
r"https://groups.google.com/forum/#!forum/salt-users",
|
2020-05-04 03:28:38 -05:00
|
|
|
r"https://www.elastic.co/logstash/docs/latest/inputs/udp",
|
|
|
|
r"https://www.elastic.co/logstash/docs/latest/inputs/zeromq",
|
2018-12-19 12:24:45 +01:00
|
|
|
r"http://www.youtube.com/saltstack",
|
|
|
|
r"https://raven.readthedocs.io",
|
|
|
|
r"https://getsentry.com",
|
|
|
|
r"https://salt-cloud.readthedocs.io",
|
|
|
|
r"https://salt.readthedocs.io",
|
|
|
|
r"http://www.pip-installer.org/",
|
|
|
|
r"http://www.windowsazure.com/",
|
|
|
|
r"https://github.com/watching",
|
|
|
|
r"dash-feed://",
|
|
|
|
r"https://github.com/saltstack/salt/",
|
2022-03-16 16:57:22 +00:00
|
|
|
r"https://bootstrap.saltproject.io",
|
2018-12-19 12:24:45 +01:00
|
|
|
r"https://raw.githubusercontent.com/saltstack/salt-bootstrap/stable/bootstrap-salt.sh",
|
|
|
|
r"media.readthedocs.org/dash/salt/latest/salt.xml",
|
|
|
|
r"https://portal.aws.amazon.com/gp/aws/securityCredentials",
|
|
|
|
r"dash-feed://https%3A//media.readthedocs.org/dash/salt/latest/salt.xml",
|
2023-02-16 15:00:20 +00:00
|
|
|
r"(?i)dns:.*",
|
|
|
|
r"TCP:4506",
|
|
|
|
r"https?://",
|
|
|
|
r"https://cloud.github.com/downloads/saltstack/.*",
|
|
|
|
r"https://INFOBLOX/.*",
|
|
|
|
r"https://SOMESERVERIP:.*",
|
|
|
|
r"https://community.saltstack.com/.*",
|
|
|
|
# GitHub Users
|
|
|
|
r"https://github.com/[^/]$",
|
|
|
|
# GitHub Salt Forks
|
|
|
|
r"https://github.com/[^/]/salt$",
|
|
|
|
r"tag:key=value",
|
|
|
|
r"jdbc:mysql:.*",
|
|
|
|
r"http:post",
|
2018-12-19 12:24:45 +01:00
|
|
|
]
|
2023-02-16 15:00:20 +00:00
|
|
|
linkcheck_exclude_documents = [
|
|
|
|
r"topics/releases/(2015|2016)\..*\.rst",
|
|
|
|
r"topics/releases/saltapi/0\.8\.0.*",
|
|
|
|
]
|
|
|
|
linkcheck_timeout = 10
|
2014-02-20 16:16:59 -07:00
|
|
|
linkcheck_anchors = False
|
2011-05-23 14:51:31 +08:00
|
|
|
|
2011-10-10 19:23:39 -06:00
|
|
|
### Manpage options
|
2011-05-23 14:51:31 +08:00
|
|
|
# One entry per manual page. List of tuples
|
|
|
|
# (source start file, name, description, authors, manual section).
|
|
|
|
authors = [
|
2012-07-13 09:38:59 -06:00
|
|
|
"Thomas S. Hatch <thatch45@gmail.com> and many others, please see the Authors file",
|
2011-05-23 14:51:31 +08:00
|
|
|
]
|
|
|
|
|
|
|
|
man_pages = [
|
2012-06-04 16:40:34 -06:00
|
|
|
("contents", "salt", "Salt Documentation", authors, 7),
|
2013-08-10 16:03:07 +01:00
|
|
|
("ref/cli/salt", "salt", "salt", authors, 1),
|
2012-06-04 16:40:34 -06:00
|
|
|
("ref/cli/salt-master", "salt-master", "salt-master Documentation", authors, 1),
|
|
|
|
("ref/cli/salt-minion", "salt-minion", "salt-minion Documentation", authors, 1),
|
|
|
|
("ref/cli/salt-key", "salt-key", "salt-key Documentation", authors, 1),
|
|
|
|
("ref/cli/salt-cp", "salt-cp", "salt-cp Documentation", authors, 1),
|
|
|
|
("ref/cli/salt-call", "salt-call", "salt-call Documentation", authors, 1),
|
2015-09-01 17:09:35 -06:00
|
|
|
("ref/cli/salt-proxy", "salt-proxy", "salt-proxy Documentation", authors, 1),
|
2012-06-04 16:40:34 -06:00
|
|
|
("ref/cli/salt-syndic", "salt-syndic", "salt-syndic Documentation", authors, 1),
|
|
|
|
("ref/cli/salt-run", "salt-run", "salt-run Documentation", authors, 1),
|
2013-08-10 16:03:07 +01:00
|
|
|
("ref/cli/salt-ssh", "salt-ssh", "salt-ssh Documentation", authors, 1),
|
2013-11-08 14:40:13 -07:00
|
|
|
("ref/cli/salt-cloud", "salt-cloud", "Salt Cloud Command", authors, 1),
|
2014-06-20 10:19:27 -06:00
|
|
|
("ref/cli/salt-api", "salt-api", "salt-api Command", authors, 1),
|
2015-07-07 16:54:26 -06:00
|
|
|
("ref/cli/spm", "spm", "Salt Package Manager Command", authors, 1),
|
2011-05-23 14:51:31 +08:00
|
|
|
]
|
2011-11-06 19:16:34 -07:00
|
|
|
|
|
|
|
|
2012-05-29 16:17:03 -07:00
|
|
|
def skip_mod_init_member(app, what, name, obj, skip, options):
|
2018-12-19 12:24:45 +01:00
|
|
|
# pylint: disable=too-many-arguments,unused-argument
|
2012-06-10 08:20:47 -07:00
|
|
|
if name.startswith("_"):
|
|
|
|
return True
|
2012-05-29 16:17:03 -07:00
|
|
|
if isinstance(obj, types.FunctionType) and obj.__name__ == "mod_init":
|
|
|
|
return True
|
|
|
|
return False
|
|
|
|
|
2012-06-19 13:39:33 +05:30
|
|
|
|
|
|
|
def _normalize_version(args):
|
|
|
|
_, path = args
|
|
|
|
return ".".join([x.zfill(4) for x in (path.split("/")[-1].split("."))])
|
|
|
|
|
|
|
|
|
|
|
|
class ReleasesTree(TocTree):
|
|
|
|
option_spec = dict(TocTree.option_spec)
|
|
|
|
|
|
|
|
def run(self):
|
2020-07-30 16:51:03 -05:00
|
|
|
rst = super().run()
|
2012-06-19 13:39:33 +05:30
|
|
|
entries = rst[0][0]["entries"][:]
|
|
|
|
entries.sort(key=_normalize_version, reverse=True)
|
|
|
|
rst[0][0]["entries"][:] = entries
|
|
|
|
return rst
|
|
|
|
|
|
|
|
|
2023-11-16 12:01:30 +00:00
|
|
|
def copy_release_templates_pre(app):
|
|
|
|
app._copied_release_files = []
|
|
|
|
docs_path = pathlib.Path(docs_basepath)
|
|
|
|
release_files_dir = docs_path / "topics" / "releases"
|
|
|
|
release_template_files_dir = release_files_dir / "templates"
|
|
|
|
for fpath in release_template_files_dir.iterdir():
|
|
|
|
dest = release_files_dir / fpath.name.replace(".template", "")
|
|
|
|
if dest.exists():
|
|
|
|
continue
|
|
|
|
log.info(
|
|
|
|
"Copying '%s' -> '%s' just for this build ...",
|
|
|
|
fpath.relative_to(docs_path),
|
|
|
|
dest.relative_to(docs_path),
|
|
|
|
)
|
|
|
|
app._copied_release_files.append(dest)
|
|
|
|
shutil.copyfile(fpath, dest)
|
|
|
|
|
|
|
|
|
|
|
|
def copy_release_templates_post(app, exception):
|
|
|
|
docs_path = pathlib.Path(docs_basepath)
|
|
|
|
for fpath in app._copied_release_files:
|
|
|
|
log.info(
|
|
|
|
"The release file '%s' was copied for the build, but its not in "
|
|
|
|
"version control system. Deleting.",
|
|
|
|
fpath.relative_to(docs_path),
|
|
|
|
)
|
|
|
|
fpath.unlink()
|
|
|
|
|
|
|
|
|
2023-11-16 11:25:04 +00:00
|
|
|
def extract_module_deprecations(app, what, name, obj, options, lines):
|
|
|
|
"""
|
|
|
|
Add a warning to the modules being deprecated into extensions.
|
|
|
|
"""
|
|
|
|
# https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#event-autodoc-process-docstring
|
|
|
|
if what != "module":
|
|
|
|
# We're only interested in module deprecations
|
|
|
|
return
|
|
|
|
|
|
|
|
try:
|
|
|
|
deprecated_info = obj.__deprecated__
|
|
|
|
except AttributeError:
|
|
|
|
# The module is not deprecated
|
|
|
|
return
|
|
|
|
|
|
|
|
_version, _extension, _url = deprecated_info
|
|
|
|
msg = textwrap.dedent(
|
|
|
|
f"""
|
|
|
|
.. warning::
|
|
|
|
|
|
|
|
This module will be removed from Salt in version {_version} in favor of
|
|
|
|
the `{_extension} Salt Extension <{_url}>`_.
|
|
|
|
|
|
|
|
"""
|
|
|
|
)
|
|
|
|
# Modify the docstring lines in-place
|
|
|
|
lines[:] = msg.splitlines() + lines
|
|
|
|
|
|
|
|
|
2012-05-29 16:17:03 -07:00
|
|
|
def setup(app):
|
2012-06-19 13:39:33 +05:30
|
|
|
app.add_directive("releasestree", ReleasesTree)
|
2015-05-22 11:53:33 -06:00
|
|
|
app.connect("autodoc-skip-member", skip_mod_init_member)
|
2023-11-16 12:01:30 +00:00
|
|
|
app.connect("builder-inited", copy_release_templates_pre)
|
|
|
|
app.connect("build-finished", copy_release_templates_post)
|
2023-11-16 11:25:04 +00:00
|
|
|
app.connect("autodoc-process-docstring", extract_module_deprecations)
|