tools/docs/get_feat.py
Source file repositories/reference/linux-study-clean/tools/docs/get_feat.py
File Facts
- System
- Linux kernel
- Corpus path
tools/docs/get_feat.py- Extension
.py- Size
- 7650 bytes
- Lines
- 226
- 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
# pylint: disable=R0902,R0911,R0912,R0914,R0915
# Copyright(c) 2025: Mauro Carvalho Chehab <mchehab@kernel.org>.
# SPDX-License-Identifier: GPL-2.0
"""
Parse the Linux Feature files and produce a ReST book.
"""
import argparse
import os
import subprocess
import sys
from pprint import pprint
LIB_DIR = "../../tools/lib/python"
SRC_DIR = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, os.path.join(SRC_DIR, LIB_DIR))
from feat.parse_features import ParseFeature # pylint: disable=C0413
SRCTREE = os.path.join(os.path.dirname(os.path.realpath(__file__)), "../..")
DEFAULT_DIR = "Documentation/features"
class GetFeature:
"""Helper class to parse feature parsing parameters"""
@staticmethod
def get_current_arch():
"""Detects the current architecture"""
proc = subprocess.run(["uname", "-m"], check=True,
capture_output=True, text=True)
arch = proc.stdout.strip()
if arch in ["x86_64", "i386"]:
arch = "x86"
elif arch == "s390x":
arch = "s390"
return arch
def run_parser(self, args):
"""Execute the feature parser"""
feat = ParseFeature(args.directory, args.debug, args.enable_fname)
data = feat.parse()
if args.debug > 2:
pprint(data)
return feat
def run_rest(self, args):
"""
Generate tables in ReST format. Three types of tables are
supported, depending on the calling arguments:
- neither feature nor arch is passed: generates a full matrix;
- arch provided: generates a table of supported tables for the
guiven architecture, eventually filtered by feature;
- only feature provided: generates a table with feature details,
showing what architectures it is implemented.
"""
feat = self.run_parser(args)
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.