tools/docs/sphinx-pre-install
Source file repositories/reference/linux-study-clean/tools/docs/sphinx-pre-install
File Facts
- System
- Linux kernel
- Corpus path
tools/docs/sphinx-pre-install- Extension
[no extension]- Size
- 55544 bytes
- Lines
- 1544
- 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.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) 2017-2025 Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
#
# pylint: disable=C0103,C0114,C0115,C0116,C0301,C0302
# pylint: disable=R0902,R0904,R0911,R0912,R0914,R0915,R1705,R1710,E1121
# Note: this script requires at least Python 3.6 to run.
# Don't add changes not compatible with it, it is meant to report
# incompatible python versions.
"""
Dependency checker for Sphinx documentation Kernel build.
This module provides tools to check for all required dependencies needed to
build documentation using Sphinx, including system packages, Python modules
and LaTeX packages for PDF generation.
It detect packages for a subset of Linux distributions used by Kernel
maintainers, showing hints and missing dependencies.
The main class SphinxDependencyChecker handles the dependency checking logic
and provides recommendations for installing missing packages. It supports both
system package installations and Python virtual environments. By default,
system pacage install is recommended.
"""
import argparse
import locale
import os
import re
import subprocess
import sys
from glob import glob
import os.path
src_dir = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, os.path.join(src_dir, '../lib/python'))
from kdoc.python_version import PythonVersion
RECOMMENDED_VERSION = PythonVersion("3.4.3").version
MIN_PYTHON_VERSION = PythonVersion("3.7").version
class DepManager:
"""
Manage package dependencies. There are three types of dependencies:
- System: dependencies required for docs build;
- Python: python dependencies for a native distro Sphinx install;
- PDF: dependencies needed by PDF builds.
Each dependency can be mandatory or optional. Not installing an optional
dependency won't break the build, but will cause degradation at the
docs output.
"""
# Internal types of dependencies. Don't use them outside DepManager class.
_SYS_TYPE = 0
_PHY_TYPE = 1
_PDF_TYPE = 2
# Dependencies visible outside the class.
# The keys are tuple with: (type, is_mandatory flag).
#
# Currently we're not using all optional dep types. Yet, we'll keep all
# possible combinations here. They're not many, and that makes easier
# if later needed and for the name() method below
SYSTEM_MANDATORY = (_SYS_TYPE, True)
Annotation
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.