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