summaryrefslogtreecommitdiff
path: root/tools/docs/parse-headers.py
diff options
context:
space:
mode:
authorJonathan Corbet <corbet@lwn.net>2025-11-18 19:26:11 +0300
committerJonathan Corbet <corbet@lwn.net>2025-11-18 19:26:11 +0300
commit34a28245b6a5c4227b7122c0ff9b98d22b39f033 (patch)
tree5f1e928a65d14b06b264b4c381b032acc1a6dbd3 /tools/docs/parse-headers.py
parentf690e07859e67505e7106ef5b4fae5e8b71b2109 (diff)
parent992a9df41ad7173588bf90e15b33d45db2811aea (diff)
downloadlinux-34a28245b6a5c4227b7122c0ff9b98d22b39f033.tar.xz
Merge branch 'python-modules' into docs-mw
scripts/lib was always a bit of an awkward place for Python libraries; give them a proper home under tools/lib/python. Put the modules from tools/docs/lib there for good measure. The second patch ties them into a single package namespace. It would be more aesthetically pleasing to add a kernel layer, so we could say: from kernel.kdoc import kdoc_parser ...and have the kernel-specific stuff clearly marked, but that means adding an empty directory in the hierarchy, which isn't as pleasing. There are some other "Python library" directories hidden in the kernel tree; we may eventually want to encourage them to move as well.
Diffstat (limited to 'tools/docs/parse-headers.py')
-rwxr-xr-xtools/docs/parse-headers.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/tools/docs/parse-headers.py b/tools/docs/parse-headers.py
index 6716c7300258..436acea4c6ca 100755
--- a/tools/docs/parse-headers.py
+++ b/tools/docs/parse-headers.py
@@ -24,10 +24,13 @@ The optional ``FILE_RULES`` contains a set of rules like:
replace define V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ :c:type:`v4l2_event_motion_det`
"""
-import argparse
+import argparse, sys
+import os.path
-from lib.parse_data_structs import ParseDataStructs
-from lib.enrich_formatter import EnrichFormatter
+src_dir = os.path.dirname(os.path.realpath(__file__))
+sys.path.insert(0, os.path.join(src_dir, '../lib/python'))
+from kdoc.parse_data_structs import ParseDataStructs
+from kdoc.enrich_formatter import EnrichFormatter
def main():
"""Main function"""