Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 679fe04

Browse files
[3.11] Set hosted_on for Read the Docs builds (GH-114697) (#114735)
Co-authored-by: Hugo van Kemenade <[email protected]>
1 parent 3dd3b30 commit 679fe04

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

Doc/conf.py

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
# The contents of this file are pickled, so don't put values in the namespace
77
# that aren't pickleable (module imports are okay, they're removed automatically).
88

9-
import sys, os, time
9+
import os
10+
import sys
11+
import time
1012
sys.path.append(os.path.abspath('tools/extensions'))
1113
sys.path.append(os.path.abspath('includes'))
1214

@@ -44,7 +46,7 @@
4446

4547
# General substitutions.
4648
project = 'Python'
47-
copyright = '2001-%s, Python Software Foundation' % time.strftime('%Y')
49+
copyright = f"2001-{time.strftime('%Y')}, Python Software Foundation"
4850

4951
# We look for the Include/patchlevel.h file in the current Python source tree
5052
# and replace the values accordingly.
@@ -283,6 +285,9 @@
283285
'root_include_title': False # We use the version switcher instead.
284286
}
285287

288+
if os.getenv("READTHEDOCS"):
289+
html_theme_options["hosted_on"] = '<a href="https://about.readthedocs.com/">Read the Docs</a>'
290+
286291
# Override stylesheet fingerprinting for Windows CHM htmlhelp to fix GH-91207
287292
# https://github.com/python/cpython/issues/91207
288293
if any('htmlhelp' in arg for arg in sys.argv):
@@ -291,7 +296,7 @@
291296
print("It may be removed in the future\n")
292297

293298
# Short title used e.g. for <title> HTML tags.
294-
html_short_title = '%s Documentation' % release
299+
html_short_title = f'{release} Documentation'
295300

296301
# Deployment preview information
297302
# (See .readthedocs.yml and https://docs.readthedocs.io/en/stable/reference/environment-variables.html)
@@ -340,26 +345,22 @@
340345

341346
latex_engine = 'xelatex'
342347

343-
# Get LaTeX to handle Unicode correctly
344348
latex_elements = {
345-
}
346-
347-
# Additional stuff for the LaTeX preamble.
348-
latex_elements['preamble'] = r'''
349+
# For the LaTeX preamble.
350+
'preamble': r'''
349351
\authoraddress{
350352
\sphinxstrong{Python Software Foundation}\\
351353
Email: \sphinxemail{[email protected]}
352354
}
353355
\let\Verbatim=\OriginalVerbatim
354356
\let\endVerbatim=\endOriginalVerbatim
355357
\setcounter{tocdepth}{2}
356-
'''
357-
358-
# The paper size ('letter' or 'a4').
359-
latex_elements['papersize'] = 'a4'
360-
361-
# The font size ('10pt', '11pt' or '12pt').
362-
latex_elements['pointsize'] = '10pt'
358+
''',
359+
# The paper size ('letter' or 'a4').
360+
'papersize': 'a4',
361+
# The font size ('10pt', '11pt' or '12pt').
362+
'pointsize': '10pt',
363+
}
363364

364365
# Grouping the document tree into LaTeX files. List of tuples
365366
# (source start file, target name, title, author, document class [howto/manual]).
@@ -424,9 +425,9 @@
424425

425426
# Regexes to find C items in the source files.
426427
coverage_c_regexes = {
427-
'cfunction': (r'^PyAPI_FUNC\(.*\)\s+([^_][\w_]+)'),
428-
'data': (r'^PyAPI_DATA\(.*\)\s+([^_][\w_]+)'),
429-
'macro': (r'^#define ([^_][\w_]+)\(.*\)[\s|\\]'),
428+
'cfunction': r'^PyAPI_FUNC\(.*\)\s+([^_][\w_]+)',
429+
'data': r'^PyAPI_DATA\(.*\)\s+([^_][\w_]+)',
430+
'macro': r'^#define ([^_][\w_]+)\(.*\)[\s|\\]',
430431
}
431432

432433
# The coverage checker will ignore all C items whose names match these regexes

0 commit comments

Comments
 (0)