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