conf.py

  1# -*- coding: utf-8 -*-
  2
  3# Default settings
  4project = 'Test Builds'
  5extensions = [
  6    'sphinx_autorun',
  7]
  8
  9latex_engine = 'xelatex'  # allow us to build Unicode chars
 10
 11
 12# Include all your settings here
 13html_theme = 'sphinx_rtd_theme'
 14
 15
 16
 17
 18###########################################################################
 19#          auto-created readthedocs.org specific configuration            #
 20###########################################################################
 21
 22
 23#
 24# The following code was added during an automated build on readthedocs.org
 25# It is auto created and injected for every build. The result is based on the
 26# conf.py.tmpl file found in the readthedocs.org codebase:
 27# https://github.com/rtfd/readthedocs.org/blob/main/readthedocs/doc_builder/templates/doc_builder/conf.py.tmpl
 28#
 29# Note: this file shouldn't rely on extra dependencies.
 30
 31import importlib
 32import sys
 33import os.path
 34
 35# Borrowed from six.
 36PY3 = sys.version_info[0] == 3
 37string_types = str if PY3 else basestring
 38
 39from sphinx import version_info
 40
 41# Get suffix for proper linking to GitHub
 42# This is deprecated in Sphinx 1.3+,
 43# as each page can have its own suffix
 44if globals().get('source_suffix', False):
 45    if isinstance(source_suffix, string_types):
 46        SUFFIX = source_suffix
 47    elif isinstance(source_suffix, (list, tuple)):
 48        # Sphinx >= 1.3 supports list/tuple to define multiple suffixes
 49        SUFFIX = source_suffix[0]
 50    elif isinstance(source_suffix, dict):
 51        # Sphinx >= 1.8 supports a mapping dictionary for multiple suffixes
 52        SUFFIX = list(source_suffix.keys())[0]  # make a ``list()`` for py2/py3 compatibility
 53    else:
 54        # default to .rst
 55        SUFFIX = '.rst'
 56else:
 57    SUFFIX = '.rst'
 58
 59# Add RTD Static Path. Add to the end because it overwrites previous files.
 60if not 'html_static_path' in globals():
 61    html_static_path = []
 62if os.path.exists('_static'):
 63    html_static_path.append('_static')
 64
 65# Add RTD Theme only if they aren't overriding it already
 66using_rtd_theme = (
 67    (
 68        'html_theme' in globals() and
 69        html_theme in ['default'] and
 70        # Allow people to bail with a hack of having an html_style
 71        'html_style' not in globals()
 72    ) or 'html_theme' not in globals()
 73)
 74if using_rtd_theme:
 75    html_theme = 'sphinx_rtd_theme'
 76    html_style = None
 77    html_theme_options = {}
 78
 79
 80# This following legacy behavior will gradually be sliced out until its deprecated and removed.
 81# Skipped for Sphinx 6+
 82# Skipped by internal Feature flag SKIP_SPHINX_HTML_THEME_PATH
 83# Skipped by all new projects since SKIP_SPHINX_HTML_THEME_PATH's introduction (jan 2023)
 84if (
 85        using_rtd_theme
 86        and version_info < (6,0)
 87        and not False
 88    ):
 89    theme = importlib.import_module('sphinx_rtd_theme')
 90    if 'html_theme_path' in globals():
 91        html_theme_path.append(theme.get_html_theme_path())
 92    else:
 93        html_theme_path = [theme.get_html_theme_path()]
 94
 95# Define websupport2_base_url and websupport2_static_url
 96if globals().get('websupport2_base_url', False):
 97    websupport2_base_url = 'https://readthedocs.org/websupport'
 98    websupport2_static_url = 'https://assets.readthedocs.org/static/'
 99
100
101#Add project information to the template context.
102context = {
103    'using_theme': using_rtd_theme,
104    'html_theme': html_theme,
105    'current_version': "build-jobs",
106    'version_slug': "build-jobs",
107    'MEDIA_URL': "https://media.readthedocs.org/",
108    'STATIC_URL': "https://assets.readthedocs.org/static/",
109    'PRODUCTION_DOMAIN': "readthedocs.org",
110    'proxied_static_path': "/_/static/",
111    'versions': [
112    ("latest", "/en/latest/"),
113    ("4.0", "/en/4.0/"),
114    ("2.0", "/en/2.0/"),
115    ("yaml-v2", "/en/yaml-v2/"),
116    ("wormhole", "/en/wormhole/"),
117    ("use-requirements-from-submodule", "/en/use-requirements-from-submodule/"),
118    ("use-py2", "/en/use-py2/"),
119    ("use-apt", "/en/use-apt/"),
120    ("unicode-filename", "/en/unicode-filename/"),
121    ("d--branch", "/en/d--branch/"),
122    ("ubuntu-22.04", "/en/ubuntu-22.04/"),
123    ("typlog-theme", "/en/typlog-theme/"),
124    ("timetestlarge", "/en/timetestlarge/"),
125    ("timetest", "/en/timetest/"),
126    ("timeout", "/en/timeout/"),
127    ("throw-exception", "/en/throw-exception/"),
128    ("test-paths-with-spaces", "/en/test-paths-with-spaces/"),
129    ("testing-activate-version", "/en/testing-activate-version/"),
130    ("sudo-commands", "/en/sudo-commands/"),
131    ("submodule-not-found", "/en/submodule-not-found/"),
132    ("submodule-https-scheme", "/en/submodule-https-scheme/"),
133    ("submodule-git-scheme", "/en/submodule-git-scheme/"),
134    ("staticrypt", "/en/staticrypt/"),
135    ("sphinx-tectonic-pdf", "/en/sphinx-tectonic-pdf/"),
136    ("sphinx-tabs", "/en/sphinx-tabs/"),
137    ("sphinx-multipage-html", "/en/sphinx-multipage-html/"),
138    ("sphinx-mkdocstrings", "/en/sphinx-mkdocstrings/"),
139    ("sphinx-latest", "/en/sphinx-latest/"),
140    ("sphinx-hoverxref", "/en/sphinx-hoverxref/"),
141    ("sphinx.ext.duration", "/en/sphinx.ext.duration/"),
142    ("sphinx-es-suggest", "/en/sphinx-es-suggest/"),
143    ("sphinx-docs-zundler", "/en/sphinx-docs-zundler/"),
144    ("sphinx-conf-nonstandard", "/en/sphinx-conf-nonstandard/"),
145    ("sphinx6.x-default", "/en/sphinx6.x-default/"),
146    ("sphinx5.x-default-confpy", "/en/sphinx5.x-default-confpy/"),
147    ("sphinx-5.x", "/en/sphinx-5.x/"),
148    ("skip-build-command", "/en/skip-build-command/"),
149    ("singlehtml", "/en/singlehtml/"),
150    ("shot-scraper", "/en/shot-scraper/"),
151    ("search-with-old-sphinx-and-theme", "/en/search-with-old-sphinx-and-theme/"),
152    ("rust", "/en/rust/"),
153    ("robots-txt", "/en/robots-txt/"),
154    ("requirements-not-found", "/en/requirements-not-found/"),
155    ("regular-404-page", "/en/regular-404-page/"),
156    ("recommonmark", "/en/recommonmark/"),
157    ("readthedocs-docs-build-commands", "/en/readthedocs-docs-build-commands/"),
158    ("pypy3.5", "/en/pypy3.5/"),
159    ("pygments-custom-lexer-apex", "/en/pygments-custom-lexer-apex/"),
160    ("py3.9", "/en/py3.9/"),
161    ("py3.8", "/en/py3.8/"),
162    ("py3.11", "/en/py3.11/"),
163    ("py3.10", "/en/py3.10/"),
164    ("pr-visual-diff", "/en/pr-visual-diff/"),
165    ("pr-homepage-edition", "/en/pr-homepage-edition/"),
166    ("poetry-asdf", "/en/poetry-asdf/"),
167    ("poetry", "/en/poetry/"),
168    ("pelican", "/en/pelican/"),
169    ("pdf-rinohtype", "/en/pdf-rinohtype/"),
170    ("pdf-cmd-fail", "/en/pdf-cmd-fail/"),
171    ("path-with-plus", "/en/path-with-plus/"),
172    ("old-output-directory", "/en/old-output-directory/"),
173    ("no-conf-py", "/en/no-conf-py/"),
174    ("no-config-file", "/en/no-config-file/"),
175    ("nbsphinx-3d-plot", "/en/nbsphinx-3d-plot/"),
176    ("multiple-source-suffix", "/en/multiple-source-suffix/"),
177    ("mkdocs-python-tags", "/en/mkdocs-python-tags/"),
178    ("mkdocs-pdf", "/en/mkdocs-pdf/"),
179    ("mkdocs-material", "/en/mkdocs-material/"),
180    ("mkdocs-htmlzip", "/en/mkdocs-htmlzip/"),
181    ("mkdocs-config-at-root", "/en/mkdocs-config-at-root/"),
182    ("mkdocs", "/en/mkdocs/"),
183    ("meta-tags", "/en/meta-tags/"),
184    ("manual-integrations", "/en/manual-integrations/"),
185    ("manual-integration-docsify", "/en/manual-integration-docsify/"),
186    ("mamba", "/en/mamba/"),
187    ("jsdoc-autoapi", "/en/jsdoc-autoapi/"),
188    ("jsdoc", "/en/jsdoc/"),
189    ("japanese-pdf", "/en/japanese-pdf/"),
190    ("invalid-submodules", "/en/invalid-submodules/"),
191    ("install-setuptools", "/en/install-setuptools/"),
192    ("huge-build-output", "/en/huge-build-output/"),
193    ("htmldir", "/en/htmldir/"),
194    ("git-submodules-invalid", "/en/git-submodules-invalid/"),
195    ("git-submodules", "/en/git-submodules/"),
196    ("git-lfs-build-jobs", "/en/git-lfs-build-jobs/"),
197    ("file-with-apostrophe", "/en/file-with-apostrophe/"),
198    ("expose-env-pip-error", "/en/expose-env-pip-error/"),
199    ("explicit-flyout-placement", "/en/explicit-flyout-placement/"),
200    ("envvar-config-file", "/en/envvar-config-file/"),
201    ("environment-variables", "/en/environment-variables/"),
202    ("docusaurus", "/en/docusaurus/"),
203    ("docsify-ads", "/en/docsify-ads/"),
204    ("docsify", "/en/docsify/"),
205    ("datetime", "/en/datetime/"),
206    ("d2lbook", "/en/d2lbook/"),
207    ("custom-404-page", "/en/custom-404-page/"),
208    ("conda-pin-common-deps", "/en/conda-pin-common-deps/"),
209    ("conda-env-py3.7", "/en/conda-env-py3.7/"),
210    ("conda-env-no-py-pinned", "/en/conda-env-no-py-pinned/"),
211    ("conda-env", "/en/conda-env/"),
212    ("c-dependencies", "/en/c-dependencies/"),
213    ("build-tools-mamba", "/en/build-tools-mamba/"),
214    ("build-tools-conda", "/en/build-tools-conda/"),
215    ("build-tools", "/en/build-tools/"),
216    ("build-os-error-message", "/en/build-os-error-message/"),
217    ("build-jobs-spaces-in-command", "/en/build-jobs-spaces-in-command/"),
218    ("build-jobs-post-build", "/en/build-jobs-post-build/"),
219    ("build-jobs-multiline", "/en/build-jobs-multiline/"),
220    ("build-jobs-diff-exit", "/en/build-jobs-diff-exit/"),
221    ("build-jobs", "/en/build-jobs/"),
222    ("build-internals", "/en/build-internals/"),
223    ("build-commands-env-vars", "/en/build-commands-env-vars/"),
224    ("build-commands", "/en/build-commands/"),
225    ("branch-with-slashes", "/en/branch-with-slashes/"),
226    ("another-matching-branch", "/en/another-matching-branch/"),
227    ("annotated-tag", "/en/annotated-tag/"),
228    ("all-formats-build-jobs", "/en/all-formats-build-jobs/"),
229    ("all-formats-build-commands", "/en/all-formats-build-commands/"),
230    ("all-formats", "/en/all-formats/"),
231    ("alabaster-theme", "/en/alabaster-theme/"),
232    ],
233    'downloads': [ 
234    ],
235    'subprojects': [ 
236    ],
237    'slug': 'test-builds',
238    'name': u'test-builds',
239    'rtd_language': u'en',
240    'programming_language': u'words',
241    'canonical_url': 'https://test-builds.readthedocs.io/en/latest/',
242    'analytics_code': 'UA-12341234-1',
243    'single_version': False,
244    'conf_py_path': '/docs/',
245    'api_host': 'https://readthedocs.org',
246    'github_user': 'readthedocs',
247    'proxied_api_host': '/_',
248    'github_repo': 'test-builds',
249    'github_version': 'build-jobs',
250    'display_github': True,
251    'bitbucket_user': 'None',
252    'bitbucket_repo': 'None',
253    'bitbucket_version': 'build-jobs',
254    'display_bitbucket': False,
255    'gitlab_user': 'None',
256    'gitlab_repo': 'None',
257    'gitlab_version': 'build-jobs',
258    'display_gitlab': False,
259    'READTHEDOCS': True,
260    'using_theme': (html_theme == "default"),
261    'new_theme': (html_theme == "sphinx_rtd_theme"),
262    'source_suffix': SUFFIX,
263    'ad_free': False,
264    'docsearch_disabled': False,
265    'user_analytics_code': 'UA-12341234-1',
266    'global_analytics_code': None,
267    'commit': '6c4c5365',
268}
269
270# For sphinx >=1.8 we can use html_baseurl to set the canonical URL.
271# https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_baseurl
272if version_info >= (1, 8):
273    if not globals().get('html_baseurl'):
274        html_baseurl = context['canonical_url']
275    context['canonical_url'] = None
276
277
278
279
280
281if 'html_context' in globals():
282    
283    html_context.update(context)
284    
285else:
286    html_context = context
287
288# Add custom RTD extension
289if 'extensions' in globals():
290    # Insert at the beginning because it can interfere
291    # with other extensions.
292    # See https://github.com/rtfd/readthedocs.org/pull/4054
293    extensions.insert(0, "readthedocs_ext.readthedocs")
294else:
295    extensions = ["readthedocs_ext.readthedocs"]
296
297# Add External version warning banner to the external version documentation
298if 'branch' == 'external':
299    extensions.insert(1, "readthedocs_ext.external_version_warning")
300    readthedocs_vcs_url = 'None'
301    readthedocs_build_url = 'https://readthedocs.org/projects/test-builds/builds/19932557/'
302
303project_language = 'en'
304
305# User's Sphinx configurations
306language_user = globals().get('language', None)
307latex_engine_user = globals().get('latex_engine', None)
308latex_elements_user = globals().get('latex_elements', None)
309
310# Remove this once xindy gets installed in Docker image and XINDYOPS
311# env variable is supported
312# https://github.com/rtfd/readthedocs-docker-images/pull/98
313latex_use_xindy = False
314
315chinese = any([
316    language_user in ('zh_CN', 'zh_TW'),
317    project_language in ('zh_CN', 'zh_TW'),
318])
319
320japanese = any([
321    language_user == 'ja',
322    project_language == 'ja',
323])
324
325if chinese:
326    latex_engine = latex_engine_user or 'xelatex'
327
328    latex_elements_rtd = {
329        'preamble': '\\usepackage[UTF8]{ctex}\n',
330    }
331    latex_elements = latex_elements_user or latex_elements_rtd
332elif japanese:
333    latex_engine = latex_engine_user or 'platex'
334
335# Make sure our build directory is always excluded
336exclude_patterns = globals().get('exclude_patterns', [])
337exclude_patterns.extend(['_build'])