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    theme = importlib.import_module('sphinx_rtd_theme')
 76    html_theme = 'sphinx_rtd_theme'
 77    html_style = None
 78    html_theme_options = {}
 79    if 'html_theme_path' in globals():
 80        html_theme_path.append(theme.get_html_theme_path())
 81    else:
 82        html_theme_path = [theme.get_html_theme_path()]
 83
 84if globals().get('websupport2_base_url', False):
 85    websupport2_base_url = 'https://readthedocs.org/websupport'
 86    websupport2_static_url = 'https://assets.readthedocs.org/static/'
 87
 88
 89#Add project information to the template context.
 90context = {
 91    'using_theme': using_rtd_theme,
 92    'html_theme': html_theme,
 93    'current_version': "latest",
 94    'version_slug': "latest",
 95    'MEDIA_URL': "https://media.readthedocs.org/",
 96    'STATIC_URL': "https://assets.readthedocs.org/static/",
 97    'PRODUCTION_DOMAIN': "readthedocs.org",
 98    'proxied_static_path': "/_/static/",
 99    'versions': [
100    ("latest", "/en/latest/"),
101    ("4.0", "/en/4.0/"),
102    ("2.0", "/en/2.0/"),
103    ("yaml-v2", "/en/yaml-v2/"),
104    ("wormhole", "/en/wormhole/"),
105    ("use-requirements-from-submodule", "/en/use-requirements-from-submodule/"),
106    ("use-apt", "/en/use-apt/"),
107    ("unicode-filename", "/en/unicode-filename/"),
108    ("d--branch", "/en/d--branch/"),
109    ("ubuntu-22.04", "/en/ubuntu-22.04/"),
110    ("typlog-theme", "/en/typlog-theme/"),
111    ("timetestlarge", "/en/timetestlarge/"),
112    ("timetest", "/en/timetest/"),
113    ("timeout", "/en/timeout/"),
114    ("throw-exception", "/en/throw-exception/"),
115    ("test-paths-with-spaces", "/en/test-paths-with-spaces/"),
116    ("testing-activate-version", "/en/testing-activate-version/"),
117    ("sudo-commands", "/en/sudo-commands/"),
118    ("submodule-not-found", "/en/submodule-not-found/"),
119    ("submodule-https-scheme", "/en/submodule-https-scheme/"),
120    ("submodule-git-scheme", "/en/submodule-git-scheme/"),
121    ("sphinx-tabs", "/en/sphinx-tabs/"),
122    ("sphinx-mkdocstrings", "/en/sphinx-mkdocstrings/"),
123    ("sphinx-latest", "/en/sphinx-latest/"),
124    ("sphinx.ext.duration", "/en/sphinx.ext.duration/"),
125    ("sphinx-es-suggest", "/en/sphinx-es-suggest/"),
126    ("sphinx-docs-zundler", "/en/sphinx-docs-zundler/"),
127    ("sphinx-conf-nonstandard", "/en/sphinx-conf-nonstandard/"),
128    ("sphinx6.x-default", "/en/sphinx6.x-default/"),
129    ("sphinx5.x-default-confpy", "/en/sphinx5.x-default-confpy/"),
130    ("sphinx-5.x", "/en/sphinx-5.x/"),
131    ("skip-build-command", "/en/skip-build-command/"),
132    ("singlehtml", "/en/singlehtml/"),
133    ("shot-scraper", "/en/shot-scraper/"),
134    ("search-with-old-sphinx-and-theme", "/en/search-with-old-sphinx-and-theme/"),
135    ("rust", "/en/rust/"),
136    ("robots-txt", "/en/robots-txt/"),
137    ("requirements-not-found", "/en/requirements-not-found/"),
138    ("regular-404-page", "/en/regular-404-page/"),
139    ("recommonmark", "/en/recommonmark/"),
140    ("pypy3.5", "/en/pypy3.5/"),
141    ("pygments-custom-lexer-apex", "/en/pygments-custom-lexer-apex/"),
142    ("py3.9", "/en/py3.9/"),
143    ("py3.8", "/en/py3.8/"),
144    ("py3.11", "/en/py3.11/"),
145    ("py3.10", "/en/py3.10/"),
146    ("pr-visual-diff", "/en/pr-visual-diff/"),
147    ("pr-homepage-edition", "/en/pr-homepage-edition/"),
148    ("poetry-asdf", "/en/poetry-asdf/"),
149    ("poetry", "/en/poetry/"),
150    ("pelican", "/en/pelican/"),
151    ("path-with-plus", "/en/path-with-plus/"),
152    ("no-conf-py", "/en/no-conf-py/"),
153    ("no-config-file", "/en/no-config-file/"),
154    ("nbsphinx-3d-plot", "/en/nbsphinx-3d-plot/"),
155    ("multiple-source-suffix", "/en/multiple-source-suffix/"),
156    ("meta-tags", "/en/meta-tags/"),
157    ("mamba", "/en/mamba/"),
158    ("jsdoc-autoapi", "/en/jsdoc-autoapi/"),
159    ("jsdoc", "/en/jsdoc/"),
160    ("japanese-pdf", "/en/japanese-pdf/"),
161    ("invalid-submodules", "/en/invalid-submodules/"),
162    ("install-setuptools", "/en/install-setuptools/"),
163    ("huge-build-output", "/en/huge-build-output/"),
164    ("htmldir", "/en/htmldir/"),
165    ("git-submodules-invalid", "/en/git-submodules-invalid/"),
166    ("git-submodules", "/en/git-submodules/"),
167    ("git-lfs-build-jobs", "/en/git-lfs-build-jobs/"),
168    ("file-with-apostrophe", "/en/file-with-apostrophe/"),
169    ("expose-env-pip-error", "/en/expose-env-pip-error/"),
170    ("explicit-flyout-placement", "/en/explicit-flyout-placement/"),
171    ("envvar-config-file", "/en/envvar-config-file/"),
172    ("environment-variables", "/en/environment-variables/"),
173    ("docusaurus", "/en/docusaurus/"),
174    ("docsify-ads", "/en/docsify-ads/"),
175    ("docsify", "/en/docsify/"),
176    ("datetime", "/en/datetime/"),
177    ("d2lbook", "/en/d2lbook/"),
178    ("custom-404-page", "/en/custom-404-page/"),
179    ("conda-pin-common-deps", "/en/conda-pin-common-deps/"),
180    ("conda-env-py3.7", "/en/conda-env-py3.7/"),
181    ("conda-env-no-py-pinned", "/en/conda-env-no-py-pinned/"),
182    ("conda-env", "/en/conda-env/"),
183    ("c-dependencies", "/en/c-dependencies/"),
184    ("build-tools-mamba", "/en/build-tools-mamba/"),
185    ("build-tools-conda", "/en/build-tools-conda/"),
186    ("build-tools", "/en/build-tools/"),
187    ("build-os-error-message", "/en/build-os-error-message/"),
188    ("build-jobs-spaces-in-command", "/en/build-jobs-spaces-in-command/"),
189    ("build-jobs-post-build", "/en/build-jobs-post-build/"),
190    ("build-jobs-multiline", "/en/build-jobs-multiline/"),
191    ("build-jobs-diff-exit", "/en/build-jobs-diff-exit/"),
192    ("build-jobs", "/en/build-jobs/"),
193    ("build-internals", "/en/build-internals/"),
194    ("build-commands-env-vars", "/en/build-commands-env-vars/"),
195    ("build-commands", "/en/build-commands/"),
196    ("another-matching-branch", "/en/another-matching-branch/"),
197    ("annotated-tag", "/en/annotated-tag/"),
198    ("all-formats-build-jobs", "/en/all-formats-build-jobs/"),
199    ("all-formats-build-commands", "/en/all-formats-build-commands/"),
200    ("all-formats", "/en/all-formats/"),
201    ("alabaster-theme", "/en/alabaster-theme/"),
202    ],
203    'downloads': [ 
204    ],
205    'subprojects': [ 
206    ],
207    'slug': 'test-builds',
208    'name': u'test-builds',
209    'rtd_language': u'en',
210    'programming_language': u'words',
211    'canonical_url': 'https://test-builds.readthedocs.io/en/latest/',
212    'analytics_code': 'UA-12341234-1',
213    'single_version': False,
214    'conf_py_path': '/docs/',
215    'api_host': 'https://readthedocs.org',
216    'github_user': 'readthedocs',
217    'proxied_api_host': '/_',
218    'github_repo': 'test-builds',
219    'github_version': 'master',
220    'display_github': True,
221    'bitbucket_user': 'None',
222    'bitbucket_repo': 'None',
223    'bitbucket_version': 'master',
224    'display_bitbucket': False,
225    'gitlab_user': 'None',
226    'gitlab_repo': 'None',
227    'gitlab_version': 'master',
228    'display_gitlab': False,
229    'READTHEDOCS': True,
230    'using_theme': (html_theme == "default"),
231    'new_theme': (html_theme == "sphinx_rtd_theme"),
232    'source_suffix': SUFFIX,
233    'ad_free': False,
234    'docsearch_disabled': False,
235    'user_analytics_code': 'UA-12341234-1',
236    'global_analytics_code': None,
237    'commit': '8ef45ef3',
238}
239
240# For sphinx >=1.8 we can use html_baseurl to set the canonical URL.
241# https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_baseurl
242if version_info >= (1, 8):
243    if not globals().get('html_baseurl'):
244        html_baseurl = context['canonical_url']
245    context['canonical_url'] = None
246
247
248
249
250
251if 'html_context' in globals():
252    
253    html_context.update(context)
254    
255else:
256    html_context = context
257
258# Add custom RTD extension
259if 'extensions' in globals():
260    # Insert at the beginning because it can interfere
261    # with other extensions.
262    # See https://github.com/rtfd/readthedocs.org/pull/4054
263    extensions.insert(0, "readthedocs_ext.readthedocs")
264else:
265    extensions = ["readthedocs_ext.readthedocs"]
266
267# Add External version warning banner to the external version documentation
268if 'branch' == 'external':
269    extensions.insert(1, "readthedocs_ext.external_version_warning")
270    readthedocs_vcs_url = 'None'
271    readthedocs_build_url = 'https://readthedocs.org/projects/test-builds/builds/19274398/'
272
273project_language = 'en'
274
275# User's Sphinx configurations
276language_user = globals().get('language', None)
277latex_engine_user = globals().get('latex_engine', None)
278latex_elements_user = globals().get('latex_elements', None)
279
280# Remove this once xindy gets installed in Docker image and XINDYOPS
281# env variable is supported
282# https://github.com/rtfd/readthedocs-docker-images/pull/98
283latex_use_xindy = False
284
285chinese = any([
286    language_user in ('zh_CN', 'zh_TW'),
287    project_language in ('zh_CN', 'zh_TW'),
288])
289
290japanese = any([
291    language_user == 'ja',
292    project_language == 'ja',
293])
294
295if chinese:
296    latex_engine = latex_engine_user or 'xelatex'
297
298    latex_elements_rtd = {
299        'preamble': '\\usepackage[UTF8]{ctex}\n',
300    }
301    latex_elements = latex_elements_user or latex_elements_rtd
302elif japanese:
303    latex_engine = latex_engine_user or 'platex'
304
305# Make sure our build directory is always excluded
306exclude_patterns = globals().get('exclude_patterns', [])
307exclude_patterns.extend(['_build'])