tools/docs/test_doc_build.py

Source file repositories/reference/linux-study-clean/tools/docs/test_doc_build.py

File Facts

System
Linux kernel
Corpus path
tools/docs/test_doc_build.py
Extension
.py
Size
15939 bytes
Lines
514
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: tools
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0
# Copyright(c) 2025: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
#
# pylint: disable=R0903,R0912,R0913,R0914,R0917,C0301

"""
Install minimal supported requirements for different Sphinx versions
and optionally test the build.
"""

import argparse
import asyncio
import os.path
import shutil
import sys
import time
import subprocess

# Minimal python version supported by the building system.

PYTHON = os.path.basename(sys.executable)

min_python_bin = None

for i in range(9, 13):
    p = f"python3.{i}"
    if shutil.which(p):
        min_python_bin = p
        break

if not min_python_bin:
    min_python_bin = PYTHON

# Starting from 8.0, Python 3.9 is not supported anymore.
PYTHON_VER_CHANGES = {(8, 0, 0): PYTHON}

DEFAULT_VERSIONS_TO_TEST = [
    (3, 4, 3),   # Minimal supported version
    (5, 3, 0),   # CentOS Stream 9 / AlmaLinux 9
    (6, 1, 1),   # Debian 12
    (7, 2, 1),   # openSUSE Leap 15.6
    (7, 2, 6),   # Ubuntu 24.04 LTS
    (7, 4, 7),   # Ubuntu 24.10
    (7, 3, 0),   # openSUSE Tumbleweed
    (8, 1, 3),   # Fedora 42
    (8, 2, 3)    # Latest version - covers rolling distros
]

# Sphinx versions to be installed and their incremental requirements
SPHINX_REQUIREMENTS = {
    # Oldest versions we support for each package required by Sphinx 3.4.3
    (3, 4, 3): {
        "docutils": "0.16",
        "alabaster": "0.7.12",
        "babel": "2.8.0",
        "certifi": "2020.6.20",
        "docutils": "0.16",
        "idna": "2.10",
        "imagesize": "1.2.0",
        "Jinja2": "2.11.2",
        "MarkupSafe": "1.1.1",
        "packaging": "20.4",
        "Pygments": "2.6.1",
        "PyYAML": "5.1",
        "requests": "2.24.0",
        "snowballstemmer": "2.0.0",
        "sphinxcontrib-applehelp": "1.0.2",
        "sphinxcontrib-devhelp": "1.0.2",
        "sphinxcontrib-htmlhelp": "1.0.3",

Annotation

Implementation Notes