8000 Set `hosted_on` for Read the Docs builds (#114697) · python/cpython@3996cbd · GitHub
[go: up one dir, main page]

Skip to content

Commit 3996cbd

Browse files
authored
Set hosted_on for Read the Docs builds (#114697)
1 parent 53d921e commit 3996cbd

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

@@ -55,7 +57,7 @@
5557

5658
# General substitutions.
5759
project = 'Python'
58-
copyright = '2001-%s, Python Software Foundation' % time.strftime('%Y')
60+
copyright = f"2001-{time.strftime('%Y')}, Python Software Foundation"
5961

6062
# We look for the Include/patchlevel.h file in the current Python source tree
6163
# and replace the values accordingly.
@@ -302,6 +304,9 @@
302304
'root_include_title': False # We use the version switcher instead.
303305
}
304306

307+
if os.getenv("READTHEDOCS"):
308+
html_theme_options["hosted_on"] = '<a href="https://about.readthedocs.com/">Read the Docs</a>'
309+
305310
# Override stylesheet fingerprinting for Windows CHM htmlhelp to fix GH-91207
306311
# https://github.com/python/cpython/issues/91207
307312
if any('htmlhelp' in arg for arg in sys.argv):
@@ -310,7 +315,7 @@
310315
print("It may be removed in the future\n")
311316

312317
# Short title used e.g. for <title> HTML tags.
313-
html_short_title = '%s Documentation' % release
318+
html_short_title = f'{release} Documentation'
314319

315320
# Deployment preview information
316321
# (See .readthedocs.yml and https://docs.readthedocs.io/en/stable/reference/environment-variables.html)
@@ -359,26 +364,22 @@
359364

360365
latex_engine = 'xelatex'
361366

362-
# Get LaTeX to handle Unicode correctly
363367
latex_elements = {
364-
}
365-
366-
# Additional stuff for the LaTeX preamble.
367-
latex_elements['preamble'] = r'''
368+
# For the LaTeX preamble.
369+
'preamble': r'''
368370
\authoraddress{
369371
\sphinxstrong{Python Software Foundation}\\
370372
Email: \sphinxemail{docs@python.org}
371373
}
372374
\let\Verbatim=\OriginalVerbatim
373375
\let\endVerbatim=\endOriginalVerbatim
374376
\setcounter{tocdepth}{2}
375-
'''
376-
377-
# The paper size ('letter' or 'a4').
378-
latex_elements['papersize'] = 'a4'
379-
380-
# The font size ('10pt', '11pt' or '12pt').
381-
latex_elements['pointsize'] = '10pt'
377+
''',
378+
# The paper size ('letter' or 'a4').
379+
'papersize': 'a4',
380+
# The font size ('10pt', '11pt' or '12pt').
381+
'pointsize': '10pt',
382+
}
382383

383384
# Grouping the document tree into LaTeX files. List of tuples
384385
# (source start file, target name, title, author, document class [howto/manual]).
@@ -441,9 +442,9 @@
441442

442443
# Regexes to find C items in the source files.
443444
coverage_c_regexes = {
444-
'cfunction': (r'^PyAPI_FUNC\(.*\)\s+([^_][\w_]+)'),
445-
'data': (r'^PyAPI_DATA\(.*\)\s+([^_][\w_]+)'),
446-
'macro': (r'^#define ([^_][\w_]+)\(.*\)[\s|\\]'),
445+
'cfunction': r'^PyAPI_FUNC\(.*\)\s+([^_][\w_]+)',
446+
'data': r'^PyAPI_DATA\(.*\)\s+([^_][\w_]+)',
447+
'macro': r'^#define ([^_][\w_]+)\(.*\)[\s|\\]',
447448
}
448449

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

0 commit comments

Comments
 (0)
0