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

Skip to content

Commit 424df31

Browse files
[3.12] Set hosted_on for Read the Docs builds (GH-114697) (#114734)
Co-authored-by: Hugo van Kemenade <[email protected]>
1 parent eed05e2 commit 424df31

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

@@ -49,7 +51,7 @@
4951

5052
# General substitutions.
5153
project = 'Python'
52-
copyright = '2001-%s, Python Software Foundation' % time.strftime('%Y')
54+
copyright = f"2001-{time.strftime('%Y')}, Python Software Foundation"
5355

5456
# We look for the Include/patchlevel.h file in the current Python source tree
5557
# and replace the values accordingly.
@@ -291,6 +293,9 @@
291293
'root_include_title': False # We use the version switcher instead.
292294
}
293295

296+
if os.getenv("READTHEDOCS"):
297+
html_theme_options["hosted_on"] = '<a href="https://about.readthedocs.com/">Read the Docs</a>'
298+
294299
# Override stylesheet fingerprinting for Windows CHM htmlhelp to fix GH-91207
295300
# https://github.com/python/cpython/issues/91207
296301
if any('htmlhelp' in arg for arg in sys.argv):
@@ -299,7 +304,7 @@
299304
print("It may be removed in the future\n")
300305

301306
# Short title used e.g. for <title> HTML tags.
302-
html_short_title = '%s Documentation' % release
307+
html_short_title = f'{release} Documentation'
303308

304309
# Deployment preview information
305310
# (See .readthedocs.yml and https://docs.readthedocs.io/en/stable/reference/environment-variables.html)
@@ -348,26 +353,22 @@
348353

349354
latex_engine = 'xelatex'
350355

351-
# Get LaTeX to handle Unicode correctly
352356
latex_elements = {
353-
}
354-
355-
# Additional stuff for the LaTeX preamble.
356-
latex_elements['preamble'] = r'''
357+
# For the LaTeX preamble.
358+
'preamble': r'''
357359
\authoraddress{
358360
\sphinxstrong{Python Software Foundation}\\
359361
Email: \sphinxemail{[email protected]}
360362
}
361363
\let\Verbatim=\OriginalVerbatim
362364
\let\endVerbatim=\endOriginalVerbatim
363365
\setcounter{tocdepth}{2}
364-
'''
365-
366-
# The paper size ('letter' or 'a4').
367-
latex_elements['papersize'] = 'a4'
368-
369-
# The font size ('10pt', '11pt' or '12pt').
370-
latex_elements['pointsize'] = '10pt'
366+
''',
367+
# The paper size ('letter' or 'a4').
368+
'papersize': 'a4',
369+
# The font size ('10pt', '11pt' or '12pt').
370+
'pointsize': '10pt',
371+
}
371372

372373
# Grouping the document tree into LaTeX files. List of tuples
373374
# (source start file, target name, title, author, document class [howto/manual]).
@@ -431,9 +432,9 @@
431432

432433
# Regexes to find C items in the source files.
433434
coverage_c_regexes = {
434-
'cfunction': (r'^PyAPI_FUNC\(.*\)\s+([^_][\w_]+)'),
435-
'data': (r'^PyAPI_DATA\(.*\)\s+([^_][\w_]+)'),
436-
'macro': (r'^#define ([^_][\w_]+)\(.*\)[\s|\\]'),
435+
'cfunction': r'^PyAPI_FUNC\(.*\)\s+([^_][\w_]+)',
436+
'data': r'^PyAPI_DATA\(.*\)\s+([^_][\w_]+)',
437+
'macro': r'^#define ([^_][\w_]+)\(.*\)[\s|\\]',
437438
}
438439

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

0 commit comments

Comments
 (0)