From e394e0735fa0a73908534aae9453d619a925e3f2 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sun, 28 Jan 2024 21:17:32 +0200 Subject: [PATCH 1/5] Set hosted_on for Read the Docs builds --- Doc/conf.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Doc/conf.py b/Doc/conf.py index 458954370debe2..2409ba59883356 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -292,6 +292,9 @@ 'root_include_title': False # We use the version switcher instead. } +if os.getenv("READTHEDOCS"): + html_theme_options["hosted_on"] = 'Read the Docs' + # Override stylesheet fingerprinting for Windows CHM htmlhelp to fix GH-91207 # https://github.com/python/cpython/issues/91207 if any('htmlhelp' in arg for arg in sys.argv): From 40c8ab8387d5447b60abc89e939594a3a96eaabe Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sun, 28 Jan 2024 21:38:15 +0200 Subject: [PATCH 2/5] Rewrite dict creation as literal --- Doc/conf.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/Doc/conf.py b/Doc/conf.py index 2409ba59883356..273adfecaee552 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -352,12 +352,9 @@ latex_engine = 'xelatex' -# Get LaTeX to handle Unicode correctly latex_elements = { -} - -# Additional stuff for the LaTeX preamble. -latex_elements['preamble'] = r''' + # For the LaTeX preamble. + 'preamble': r''' \authoraddress{ \sphinxstrong{Python Software Foundation}\\ Email: \sphinxemail{docs@python.org} @@ -365,13 +362,12 @@ \let\Verbatim=\OriginalVerbatim \let\endVerbatim=\endOriginalVerbatim \setcounter{tocdepth}{2} -''' - -# The paper size ('letter' or 'a4'). -latex_elements['papersize'] = 'a4' - -# The font size ('10pt', '11pt' or '12pt'). -latex_elements['pointsize'] = '10pt' +''', + # The paper size ('letter' or 'a4'). + 'papersize': 'a4', + # The font size ('10pt', '11pt' or '12pt'). + 'pointsize': '10pt', +} # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, document class [howto/manual]). From 345f0e54b4d54ec53ca09779de395568cb6f9f70 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sun, 28 Jan 2024 21:39:06 +0200 Subject: [PATCH 3/5] Remove redundant parentheses --- Doc/conf.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/conf.py b/Doc/conf.py index 273adfecaee552..48ca42201ce856 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -430,9 +430,9 @@ # Regexes to find C items in the source files. coverage_c_regexes = { - 'cfunction': (r'^PyAPI_FUNC\(.*\)\s+([^_][\w_]+)'), - 'data': (r'^PyAPI_DATA\(.*\)\s+([^_][\w_]+)'), - 'macro': (r'^#define ([^_][\w_]+)\(.*\)[\s|\\]'), + 'cfunction': r'^PyAPI_FUNC\(.*\)\s+([^_][\w_]+)', + 'data': r'^PyAPI_DATA\(.*\)\s+([^_][\w_]+)', + 'macro': r'^#define ([^_][\w_]+)\(.*\)[\s|\\]', } # The coverage checker will ignore all C items whose names match these regexes From 04d918c247b4eacb38ec555b983e5edcfbbd75db Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sun, 28 Jan 2024 22:10:57 +0200 Subject: [PATCH 4/5] Use f-strings --- Doc/conf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/conf.py b/Doc/conf.py index 48ca42201ce856..8e89cb46d72f6c 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -55,7 +55,7 @@ # General substitutions. project = 'Python' -copyright = '2001-%s, Python Software Foundation' % time.strftime('%Y') +copyright = f"2001-{time.strftime('%Y')}, Python Software Foundation" # We look for the Include/patchlevel.h file in the current Python source tree # and replace the values accordingly. @@ -303,7 +303,7 @@ print("It may be removed in the future\n") # Short title used e.g. for