Bug 1800492 - Fix division by zero when calculating GC_TENURED_SURVIVAL_RATE telemetr...
[gecko.git] / docs / conf.py
blob53b33967180671a5ab767814475c8a1e95bf9a38
1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 from __future__ import absolute_import, unicode_literals
7 import os
8 import sys
10 # Set up Python environment to load build system packages.
11 OUR_DIR = os.path.dirname(__file__)
12 topsrcdir = os.path.normpath(os.path.join(OUR_DIR, ".."))
14 # Escapes $, [, ] and 3 dots in copy button
15 copybutton_prompt_text = r">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: "
16 copybutton_prompt_is_regexp = True
18 EXTRA_PATHS = (
19 "layout/tools/reftest",
20 "python/mach",
21 "python/mozbuild",
22 "python/mozversioncontrol",
23 "testing/mozbase/manifestparser",
24 "testing/mozbase/mozfile",
25 "testing/mozbase/mozprocess",
26 "third_party/python/jsmin",
27 "third_party/python/which",
28 "docs/_addons",
31 sys.path[:0] = [os.path.join(topsrcdir, p) for p in EXTRA_PATHS]
33 sys.path.insert(0, OUR_DIR)
35 extensions = [
36 "myst_parser",
37 "sphinx.ext.autodoc",
38 "sphinx.ext.autosectionlabel",
39 "sphinx.ext.doctest",
40 "sphinx.ext.graphviz",
41 "sphinx.ext.napoleon",
42 "sphinx.ext.todo",
43 "mozbuild.sphinx",
44 "sphinx_js",
45 "sphinxcontrib.mermaid",
46 "sphinx_copybutton",
47 "sphinx_markdown_tables",
48 "sphinx_panels",
49 "bzlink",
52 # JSDoc must run successfully for dirs specified, so running
53 # tree-wide (the default) will not work currently.
54 js_source_path = [
55 "../browser/components/extensions",
56 "../browser/components/uitour",
57 "../browser/components/urlbar",
58 "../remote/marionette",
59 "../testing/mochitest/BrowserTestUtils",
60 "../testing/mochitest/tests/SimpleTest/SimpleTest.js",
61 "../testing/mochitest/tests/SimpleTest/EventUtils.js",
62 "../testing/modules/Assert.jsm",
63 "../testing/modules/TestUtils.jsm",
64 "../toolkit/actors",
65 "../toolkit/components/extensions",
66 "../toolkit/components/extensions/parent",
67 "../toolkit/components/featuregates",
68 "../toolkit/mozapps/extensions",
69 "../toolkit/components/prompts/src",
70 "../toolkit/components/pictureinpicture",
71 "../toolkit/components/pictureinpicture/content",
73 root_for_relative_js_paths = ".."
74 jsdoc_config_path = "jsdoc.json"
76 templates_path = ["_templates"]
77 source_suffix = [".rst", ".md"]
78 master_doc = "index"
79 project = "Firefox Source Docs"
80 # Override the search box to use Google instead of
81 # sphinx search
82 html_sidebars = {
83 "**": [
84 "searchbox.html",
87 html_logo = os.path.join(
88 topsrcdir, "browser/branding/nightly/content/firefox-wordmark.svg"
90 html_favicon = os.path.join(topsrcdir, "browser/branding/nightly/firefox.ico")
91 html_js_files = ["https://cdnjs.cloudflare.com/ajax/libs/mermaid/8.9.1/mermaid.js"]
93 exclude_patterns = ["_build", "_staging", "_venv"]
94 pygments_style = "sphinx"
96 # We need to perform some adjustment of the settings and environment
97 # when running on Read The Docs.
98 on_rtd = os.environ.get("READTHEDOCS", None) == "True"
100 if on_rtd:
101 # SHELL isn't set on RTD and mach.mixin.process's import raises if a
102 # shell-related environment variable can't be found. Set the variable here
103 # to hack us into working on RTD.
104 assert "SHELL" not in os.environ
105 os.environ["SHELL"] = "/bin/bash"
106 else:
107 # We only need to set the RTD theme when not on RTD because the RTD
108 # environment handles this otherwise.
109 import sphinx_rtd_theme
111 html_theme = "sphinx_rtd_theme"
112 html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
115 html_static_path = ["_static"]
116 htmlhelp_basename = "FirefoxTreeDocs"
118 moz_project_name = "main"
120 html_show_copyright = False
122 # Only run autosection for the page title.
123 # Otherwise, we have a huge number of duplicate links.
124 # For example, the page https://firefox-source-docs.mozilla.org/code-quality/lint/
125 # is called "Linting"
126 # just like https://firefox-source-docs.mozilla.org/remote/CodeStyle.html
127 autosectionlabel_maxdepth = 1
130 def install_sphinx_panels(app, pagename, templatename, context, doctree):
131 if "perfdocs" in pagename:
132 app.add_js_file("sphinx_panels.js")
133 app.add_css_file("sphinx_panels.css")
136 def setup(app):
137 app.add_css_file("custom_theme.css")
138 app.connect("html-page-context", install_sphinx_panels)