conf.py

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