summaryrefslogtreecommitdiffstats
path: root/Doc/conf.py
diff options
context:
space:
mode:
authorAdam Turner <9087854+AA-Turner@users.noreply.github.com>2024-10-10 20:26:01 (GMT)
committerGitHub <noreply@github.com>2024-10-10 20:26:01 (GMT)
commitdd0ee201da34d1d4a631d77b420728f9233f53f9 (patch)
tree15b04c377ca808e496107a8bb9e9919683132847 /Doc/conf.py
parent427dcf24de4e06d239745d74d08c4b2e541dca5a (diff)
downloadcpython-dd0ee201da34d1d4a631d77b420728f9233f53f9.zip
cpython-dd0ee201da34d1d4a631d77b420728f9233f53f9.tar.gz
cpython-dd0ee201da34d1d4a631d77b420728f9233f53f9.tar.bz2
Doc: Upgrade Sphinx to 8.1 (#125276)
Diffstat (limited to 'Doc/conf.py')
-rw-r--r--Doc/conf.py31
1 files changed, 24 insertions, 7 deletions
diff --git a/Doc/conf.py b/Doc/conf.py
index 287e0da..d7197b1 100644
--- a/Doc/conf.py
+++ b/Doc/conf.py
@@ -11,6 +11,8 @@ import os
import sys
import time
+import sphinx
+
sys.path.append(os.path.abspath('tools/extensions'))
sys.path.append(os.path.abspath('includes'))
@@ -62,7 +64,10 @@ manpages_url = 'https://manpages.debian.org/{path}'
# General substitutions.
project = 'Python'
-copyright = f"2001-{time.strftime('%Y')}, Python Software Foundation"
+if sphinx.version_info[:2] >= (8, 1):
+ copyright = "2001-%Y, Python Software Foundation"
+else:
+ 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.
@@ -361,10 +366,14 @@ html_context = {
}
# This 'Last updated on:' timestamp is inserted at the bottom of every page.
-html_time = int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))
-html_last_updated_fmt = time.strftime(
- '%b %d, %Y (%H:%M UTC)', time.gmtime(html_time)
-)
+html_last_updated_fmt = '%b %d, %Y (%H:%M UTC)'
+if sphinx.version_info[:2] >= (8, 1):
+ html_last_updated_use_utc = True
+else:
+ html_time = int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))
+ html_last_updated_fmt = time.strftime(
+ html_last_updated_fmt, time.gmtime(html_time)
+ )
# Path to find HTML templates.
templates_path = ['tools/templates']
@@ -596,13 +605,21 @@ linkcheck_ignore = [
# mapping unique short aliases to a base URL and a prefix.
# https://www.sphinx-doc.org/en/master/usage/extensions/extlinks.html
extlinks = {
- "cve": ("https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-%s", "CVE-%s"),
- "cwe": ("https://cwe.mitre.org/data/definitions/%s.html", "CWE-%s"),
"pypi": ("https://pypi.org/project/%s/", "%s"),
"source": (SOURCE_URI, "%s"),
}
extlinks_detect_hardcoded_links = True
+if sphinx.version_info[:2] < (8, 1):
+ # Sphinx 8.1 has in-built CVE and CWE roles.
+ extlinks |= {
+ "cve": (
+ "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-%s",
+ "CVE-%s",
+ ),
+ "cwe": ("https://cwe.mitre.org/data/definitions/%s.html", "CWE-%s"),
+ }
+
# Options for c_annotations
# -------------------------