conf.py

  1# -*- coding: utf-8 -*-
  2
  3# Default settings
  4project = 'Test Builds'
  5extensions = [
  6    'sphinx_autorun',
  7]
  8
  9# Include all your settings here
 10html_theme = 'sphinx_rtd_theme'
 11
 12
 13
 14
 15###########################################################################
 16#          auto-created readthedocs.org specific configuration            #
 17###########################################################################
 18
 19
 20#
 21# The following code was added during an automated build on readthedocs.org
 22# It is auto created and injected for every build. The result is based on the
 23# conf.py.tmpl file found in the readthedocs.org codebase:
 24# https://github.com/rtfd/readthedocs.org/blob/main/readthedocs/doc_builder/templates/doc_builder/conf.py.tmpl
 25#
 26# Note: this file shouldn't rely on extra dependencies.
 27
 28import importlib
 29import sys
 30import os.path
 31
 32# Borrowed from six.
 33PY3 = sys.version_info[0] == 3
 34string_types = str if PY3 else basestring
 35
 36from sphinx import version_info
 37
 38# Get suffix for proper linking to GitHub
 39# This is deprecated in Sphinx 1.3+,
 40# as each page can have its own suffix
 41if globals().get('source_suffix', False):
 42    if isinstance(source_suffix, string_types):
 43        SUFFIX = source_suffix
 44    elif isinstance(source_suffix, (list, tuple)):
 45        # Sphinx >= 1.3 supports list/tuple to define multiple suffixes
 46        SUFFIX = source_suffix[0]
 47    elif isinstance(source_suffix, dict):
 48        # Sphinx >= 1.8 supports a mapping dictionary for multiple suffixes
 49        SUFFIX = list(source_suffix.keys())[0]  # make a ``list()`` for py2/py3 compatibility
 50    else:
 51        # default to .rst
 52        SUFFIX = '.rst'
 53else:
 54    SUFFIX = '.rst'
 55
 56# Add RTD Static Path. Add to the end because it overwrites previous files.
 57if not 'html_static_path' in globals():
 58    html_static_path = []
 59if os.path.exists('_static'):
 60    html_static_path.append('_static')
 61
 62# Add RTD Theme only if they aren't overriding it already
 63using_rtd_theme = (
 64    (
 65        'html_theme' in globals() and
 66        html_theme in ['default'] and
 67        # Allow people to bail with a hack of having an html_style
 68        'html_style' not in globals()
 69    ) or 'html_theme' not in globals()
 70)
 71if using_rtd_theme:
 72    theme = importlib.import_module('sphinx_rtd_theme')
 73    html_theme = 'sphinx_rtd_theme'
 74    html_style = None
 75    html_theme_options = {}
 76    if 'html_theme_path' in globals():
 77        html_theme_path.append(theme.get_html_theme_path())
 78    else:
 79        html_theme_path = [theme.get_html_theme_path()]
 80
 81if globals().get('websupport2_base_url', False):
 82    websupport2_base_url = 'https://readthedocs.org/websupport'
 83    websupport2_static_url = 'https://assets.readthedocs.org/static/'
 84
 85
 86#Add project information to the template context.
 87context = {
 88    'using_theme': using_rtd_theme,
 89    'html_theme': html_theme,
 90    'current_version': "japanese-pdf",
 91    'version_slug': "japanese-pdf",
 92    'MEDIA_URL': "https://media.readthedocs.org/",
 93    'STATIC_URL': "https://assets.readthedocs.org/static/",
 94    'PRODUCTION_DOMAIN': "readthedocs.org",
 95    'proxied_static_path': "/_/static/",
 96    'versions': [
 97    ("latest", "/en/latest/"),
 98    ("4.0", "/en/4.0/"),
 99    ("2.0", "/en/2.0/"),
100    ("yaml-v2", "/en/yaml-v2/"),
101    ("use-requirements-from-submodule", "/en/use-requirements-from-submodule/"),
102    ("use-py2", "/en/use-py2/"),
103    ("use-image-5.0rc1", "/en/use-image-5.0rc1/"),
104    ("use-apt", "/en/use-apt/"),
105    ("unicode-filename", "/en/unicode-filename/"),
106    ("d--branch", "/en/d--branch/"),
107    ("ubuntu-22.04", "/en/ubuntu-22.04/"),
108    ("typlog-theme", "/en/typlog-theme/"),
109    ("timetestlarge", "/en/timetestlarge/"),
110    ("timetest", "/en/timetest/"),
111    ("timeout", "/en/timeout/"),
112    ("throw-exception", "/en/throw-exception/"),
113    ("test-py-37", "/en/test-py-37/"),
114    ("test-pr-builder", "/en/test-pr-builder/"),
115    ("test-paths-with-spaces", "/en/test-paths-with-spaces/"),
116    ("testing-image", "/en/testing-image/"),
117    ("testing-activate-version", "/en/testing-activate-version/"),
118    ("test-code-injection-2", "/en/test-code-injection-2/"),
119    ("test-code-injection", "/en/test-code-injection/"),
120    ("test-agj-foo", "/en/test-agj-foo/"),
121    ("tag-v2", "/en/tag-v2/"),
122    ("tag-v1", "/en/tag-v1/"),
123    ("sudo-commands", "/en/sudo-commands/"),
124    ("submodule-https-scheme", "/en/submodule-https-scheme/"),
125    ("submodule-git-scheme", "/en/submodule-git-scheme/"),
126    ("sphinx.yaml", "/en/sphinx.yaml/"),
127    ("sphinx-tabs", "/en/sphinx-tabs/"),
128    ("sphinx-latest", "/en/sphinx-latest/"),
129    ("sphinx-fork", "/en/sphinx-fork/"),
130    ("sphinx.ext.duration", "/en/sphinx.ext.duration/"),
131    ("sphinx-es-suggest", "/en/sphinx-es-suggest/"),
132    ("sphinx-5.x", "/en/sphinx-5.x/"),
133    ("sphinx-3.x", "/en/sphinx-3.x/"),
134    ("sphinx2", "/en/sphinx2/"),
135    ("sphinx-1.8", "/en/sphinx-1.8/"),
136    ("sphinx-1.7", "/en/sphinx-1.7/"),
137    ("sphinx-1.6", "/en/sphinx-1.6/"),
138    ("search-with-old-sphinx-and-theme", "/en/search-with-old-sphinx-and-theme/"),
139    ("rust", "/en/rust/"),
140    ("run-rust", "/en/run-rust/"),
141    ("rtd-sphinx-ext", "/en/rtd-sphinx-ext/"),
142    ("robots-txt", "/en/robots-txt/"),
143    ("requirements-not-found", "/en/requirements-not-found/"),
144    ("pypy3.5", "/en/pypy3.5/"),
145    ("pygments-custom-lexer-apex", "/en/pygments-custom-lexer-apex/"),
146    ("py3.9", "/en/py3.9/"),
147    ("py3.8", "/en/py3.8/"),
148    ("py3.5", "/en/py3.5/"),
149    ("py3.11", "/en/py3.11/"),
150    ("py3.10", "/en/py3.10/"),
151    ("poetry-asdf", "/en/poetry-asdf/"),
152    ("poetry", "/en/poetry/"),
153    ("pelican", "/en/pelican/"),
154    ("path-with-plus", "/en/path-with-plus/"),
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    ("main", "/en/main/"),
161    ("jsdoc-autoapi", "/en/jsdoc-autoapi/"),
162    ("jsdoc", "/en/jsdoc/"),
163    ("japanese-pdf", "/en/japanese-pdf/"),
164    ("invalid-submodules", "/en/invalid-submodules/"),
165    ("install-pytorch", "/en/install-pytorch/"),
166    ("install-aiohttp", "/en/install-aiohttp/"),
167    ("image", "/en/image/"),
168    ("huge-build-output", "/en/huge-build-output/"),
169    ("hide-me", "/en/hide-me/"),
170    ("git-submodules", "/en/git-submodules/"),
171    ("git-lfs-build-jobs", "/en/git-lfs-build-jobs/"),
172    ("git-lfs", "/en/git-lfs/"),
173    ("file-with-apostrophe", "/en/file-with-apostrophe/"),
174    ("expose-env-pip-error", "/en/expose-env-pip-error/"),
175    ("environment-variables", "/en/environment-variables/"),
176    ("datetime", "/en/datetime/"),
177    ("custom-404-page", "/en/custom-404-page/"),
178    ("conda-satisfied-skip-solve", "/en/conda-satisfied-skip-solve/"),
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    ("code-injection-3", "/en/code-injection-3/"),
184    ("c-dependencies", "/en/c-dependencies/"),
185    ("build-tools-update-2", "/en/build-tools-update-2/"),
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-multiline", "/en/build-jobs-multiline/"),
191    ("build-jobs", "/en/build-jobs/"),
192    ("build-internals", "/en/build-internals/"),
193    ("build-commands", "/en/build-commands/"),
194    ("be-default", "/en/be-default/"),
195    ("another-matching-branch", "/en/another-matching-branch/"),
196    ("annotated-tag", "/en/annotated-tag/"),
197    ("all-formats", "/en/all-formats/"),
198    ("alabaster-theme", "/en/alabaster-theme/"),
199    ("agj-test-pr", "/en/agj-test-pr/"),
200    ("agj-rtd-tf-example", "/en/agj-rtd-tf-example/"),
201    ],
202    'downloads': [ 
203    ("pdf", "//test-builds.readthedocs.io/_/downloads/en/japanese-pdf/pdf/"),
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': 'japanese-pdf',
220    'display_github': True,
221    'bitbucket_user': 'None',
222    'bitbucket_repo': 'None',
223    'bitbucket_version': 'japanese-pdf',
224    'display_bitbucket': False,
225    'gitlab_user': 'None',
226    'gitlab_repo': 'None',
227    'gitlab_version': 'japanese-pdf',
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': '88670d70',
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/17239220/'
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'])