tools/lib/python/feat/parse_features.py
Source file repositories/reference/linux-study-clean/tools/lib/python/feat/parse_features.py
File Facts
- System
- Linux kernel
- Corpus path
tools/lib/python/feat/parse_features.py- Extension
.py- Size
- 16721 bytes
- Lines
- 508
- 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
"""
Library to parse the Linux Feature files and produce a ReST book.
"""
import os
import re
import sys
from glob import iglob
class ParseFeature:
"""
Parses Documentation/features, allowing to generate ReST documentation
from it.
"""
#: feature header string.
h_name = "Feature"
#: Kernel config header string.
h_kconfig = "Kconfig"
#: description header string.
h_description = "Description"
#: subsystem header string.
h_subsys = "Subsystem"
#: status header string.
h_status = "Status"
#: architecture header string.
h_arch = "Architecture"
#: Sort order for status. Others will be mapped at the end.
status_map = {
"ok": 0,
"TODO": 1,
"N/A": 2,
# The only missing status is "..", which was mapped as "---",
# as this is an special ReST cell value. Let it get the
# default order (99).
}
def __init__(self, prefix, debug=0, enable_fname=False):
"""
Sets internal variables.
"""
self.prefix = prefix
self.debug = debug
self.enable_fname = enable_fname
self.data = {}
# Initial maximum values use just the headers
self.max_size_name = len(self.h_name)
self.max_size_kconfig = len(self.h_kconfig)
self.max_size_description = len(self.h_description)
self.max_size_desc_word = 0
self.max_size_subsys = len(self.h_subsys)
self.max_size_status = len(self.h_status)
self.max_size_arch = len(self.h_arch)
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.