|
8 | 8 |
|
9 | 9 | import os |
10 | 10 | import sys |
11 | | -from importlib import import_module |
12 | 11 | from importlib.util import find_spec |
13 | 12 |
|
14 | 13 | # Make our custom extensions available to Sphinx |
15 | 14 | sys.path.append(os.path.abspath('tools/extensions')) |
16 | 15 | sys.path.append(os.path.abspath('includes')) |
17 | 16 |
|
18 | | -# Python specific content from Doc/Tools/extensions/pyspecific.py |
19 | | -from pyspecific import SOURCE_URI |
| 17 | +from patchlevel import get_header_version_info, get_version_info |
20 | 18 |
|
21 | 19 | # General configuration |
22 | 20 | # --------------------- |
|
78 | 76 | # We look for the Include/patchlevel.h file in the current Python source tree |
79 | 77 | # and replace the values accordingly. |
80 | 78 | # See Doc/tools/extensions/patchlevel.py |
81 | | -version, release = import_module('patchlevel').get_version_info() |
| 79 | +version, release = get_version_info() |
82 | 80 |
|
83 | 81 | rst_epilog = f""" |
84 | 82 | .. |python_version_literal| replace:: ``Python {version}`` |
|
555 | 553 | r'https://unix.org/version2/whatsnew/lp64_wp.html', |
556 | 554 | ] |
557 | 555 |
|
| 556 | + |
558 | 557 | # Options for sphinx.ext.extlinks |
559 | 558 | # ------------------------------- |
560 | 559 |
|
| 560 | +v = get_header_version_info() |
| 561 | +branch = "main" if v.releaselevel == "alpha" else f"{v.major}.{v.minor}" |
| 562 | + |
561 | 563 | # This config is a dictionary of external sites, |
562 | 564 | # mapping unique short aliases to a base URL and a prefix. |
563 | 565 | # https://www.sphinx-doc.org/en/master/usage/extensions/extlinks.html |
564 | 566 | extlinks = { |
565 | 567 | "oss-fuzz": ("https://issues.oss-fuzz.com/issues/%s", "#%s"), |
566 | 568 | "pypi": ("https://pypi.org/project/%s/", "%s"), |
567 | | - "source": (SOURCE_URI, "%s"), |
| 569 | + "source": (f"https://github.com/python/cpython/tree/{branch}/%s", "%s"), |
568 | 570 | } |
569 | 571 | extlinks_detect_hardcoded_links = True |
570 | 572 |
|
|
0 commit comments