mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	Doc: Upgrade Sphinx to 8.1 (#125276)
This commit is contained in:
		
							parent
							
								
									427dcf24de
								
							
						
					
					
						commit
						dd0ee201da
					
				
					 2 changed files with 25 additions and 8 deletions
				
			
		
							
								
								
									
										31
									
								
								Doc/conf.py
									
										
									
									
									
								
							
							
						
						
									
										31
									
								
								Doc/conf.py
									
										
									
									
									
								
							| 
						 | 
					@ -11,6 +11,8 @@
 | 
				
			||||||
import sys
 | 
					import sys
 | 
				
			||||||
import time
 | 
					import time
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import sphinx
 | 
				
			||||||
 | 
					
 | 
				
			||||||
sys.path.append(os.path.abspath('tools/extensions'))
 | 
					sys.path.append(os.path.abspath('tools/extensions'))
 | 
				
			||||||
sys.path.append(os.path.abspath('includes'))
 | 
					sys.path.append(os.path.abspath('includes'))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -62,7 +64,10 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# General substitutions.
 | 
					# General substitutions.
 | 
				
			||||||
project = 'Python'
 | 
					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
 | 
					# We look for the Include/patchlevel.h file in the current Python source tree
 | 
				
			||||||
# and replace the values accordingly.
 | 
					# and replace the values accordingly.
 | 
				
			||||||
| 
						 | 
					@ -361,10 +366,14 @@
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# This 'Last updated on:' timestamp is inserted at the bottom of every page.
 | 
					# 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 = '%b %d, %Y (%H:%M UTC)'
 | 
				
			||||||
html_last_updated_fmt = time.strftime(
 | 
					if sphinx.version_info[:2] >= (8, 1):
 | 
				
			||||||
    '%b %d, %Y (%H:%M UTC)', time.gmtime(html_time)
 | 
					    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.
 | 
					# Path to find HTML templates.
 | 
				
			||||||
templates_path = ['tools/templates']
 | 
					templates_path = ['tools/templates']
 | 
				
			||||||
| 
						 | 
					@ -596,13 +605,21 @@
 | 
				
			||||||
# mapping unique short aliases to a base URL and a prefix.
 | 
					# mapping unique short aliases to a base URL and a prefix.
 | 
				
			||||||
# https://www.sphinx-doc.org/en/master/usage/extensions/extlinks.html
 | 
					# https://www.sphinx-doc.org/en/master/usage/extensions/extlinks.html
 | 
				
			||||||
extlinks = {
 | 
					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"),
 | 
					    "pypi": ("https://pypi.org/project/%s/", "%s"),
 | 
				
			||||||
    "source": (SOURCE_URI, "%s"),
 | 
					    "source": (SOURCE_URI, "%s"),
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
extlinks_detect_hardcoded_links = True
 | 
					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
 | 
					# Options for c_annotations
 | 
				
			||||||
# -------------------------
 | 
					# -------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,7 +6,7 @@
 | 
				
			||||||
# Sphinx version is pinned so that new versions that introduce new warnings
 | 
					# Sphinx version is pinned so that new versions that introduce new warnings
 | 
				
			||||||
# won't suddenly cause build failures. Updating the version is fine as long
 | 
					# won't suddenly cause build failures. Updating the version is fine as long
 | 
				
			||||||
# as no warnings are raised by doing so.
 | 
					# as no warnings are raised by doing so.
 | 
				
			||||||
sphinx~=8.0.0
 | 
					sphinx~=8.1.0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
blurb
 | 
					blurb
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue