Documentation/conf.py

Source file repositories/reference/linux-study-clean/Documentation/conf.py

File Facts

System
Linux kernel
Corpus path
Documentation/conf.py
Extension
.py
Size
18853 bytes
Lines
618
Domain
Support Tooling And Documentation
Bucket
Documentation
Inferred role
Support Tooling And Documentation: Documentation
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

# SPDX-License-Identifier: GPL-2.0-only
# pylint: disable=C0103,C0209

"""
The Linux Kernel documentation build configuration file.
"""

import os
import shutil
import sys

from  textwrap import dedent

import sphinx

# Location of Documentation/ directory
kern_doc_dir = os.path.dirname(os.path.abspath(__file__))

# Add location of Sphinx extensions
sys.path.insert(0, os.path.join(kern_doc_dir, "sphinx"))

# Allow sphinx.ext.autodoc to document files at tools and scripts
sys.path.append(os.path.join(kern_doc_dir, "..", "tools"))
sys.path.append(os.path.join(kern_doc_dir, "..", "scripts"))

# Minimal supported version
needs_sphinx = "3.4.3"

# Get Sphinx version
major, minor, patch = sphinx.version_info[:3]          # pylint: disable=I1101

# Include_patterns were added on Sphinx 5.1
if (major < 5) or (major == 5 and minor < 1):
    has_include_patterns = False
else:
    has_include_patterns = True
    # Include patterns that don't contain directory names, in glob format
    include_patterns = ["**.rst"]

# Exclude of patterns that don't contain directory names, in glob format.
exclude_patterns = []

# List of patterns that contain directory names in glob format.
dyn_include_patterns = []
dyn_exclude_patterns = ["output", "sphinx-includes"]

# Currently, only netlink/specs has a parser for yaml.
# Prefer using include patterns if available, as it is faster
if has_include_patterns:
    dyn_include_patterns.append("netlink/specs/*.yaml")
else:
    dyn_exclude_patterns.append("netlink/*.yaml")
    dyn_exclude_patterns.append("devicetree/bindings/**.yaml")
    dyn_exclude_patterns.append("core-api/kho/bindings/**.yaml")

# Link to man pages
manpages_url = 'https://man7.org/linux/man-pages/man{section}/{page}.{section}.html'

# Properly handle directory patterns and LaTeX docs
# -------------------------------------------------

def config_init(app, config):
    """
    Initialize path-dependent variabled

    On Sphinx, all directories are relative to what it is passed as
    SOURCEDIR parameter for sphinx-build. Due to that, all patterns
    that have directory names on it need to be dynamically set, after
    converting them to a relative patch.

Annotation

Implementation Notes