]> Gentwo Git Trees - linux/.git/commitdiff
docs: Move the python libraries to tools/lib/python
authorJonathan Corbet <corbet@lwn.net>
Mon, 10 Nov 2025 22:04:29 +0000 (15:04 -0700)
committerJonathan Corbet <corbet@lwn.net>
Tue, 18 Nov 2025 16:22:40 +0000 (09:22 -0700)
"scripts/lib" was always a bit of an awkward place for Python modules.  We
already have tools/lib; create a tools/lib/python, move the libraries
there, and update the users accordingly.

While at it, move the contents of tools/docs/lib.  Rather than make another
directory, just put these documentation-oriented modules under "kdoc".

Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Message-ID: <20251110220430.726665-2-corbet@lwn.net>

28 files changed:
.pylintrc
Documentation/Makefile
Documentation/sphinx/kernel_abi.py
Documentation/sphinx/kernel_include.py
Documentation/sphinx/kerneldoc.py
MAINTAINERS
scripts/jobserver-exec
scripts/kernel-doc.py
tools/docs/check-variable-fonts.py
tools/docs/get_abi.py
tools/docs/lib/__init__.py [deleted file]
tools/docs/parse-headers.py
tools/docs/sphinx-build-wrapper
tools/docs/sphinx-pre-install
tools/lib/python/abi/abi_parser.py [moved from scripts/lib/abi/abi_parser.py with 100% similarity]
tools/lib/python/abi/abi_regex.py [moved from scripts/lib/abi/abi_regex.py with 100% similarity]
tools/lib/python/abi/helpers.py [moved from scripts/lib/abi/helpers.py with 100% similarity]
tools/lib/python/abi/system_symbols.py [moved from scripts/lib/abi/system_symbols.py with 100% similarity]
tools/lib/python/jobserver.py [moved from scripts/lib/jobserver.py with 100% similarity]
tools/lib/python/kdoc/enrich_formatter.py [moved from tools/docs/lib/enrich_formatter.py with 100% similarity]
tools/lib/python/kdoc/kdoc_files.py [moved from scripts/lib/kdoc/kdoc_files.py with 100% similarity]
tools/lib/python/kdoc/kdoc_item.py [moved from scripts/lib/kdoc/kdoc_item.py with 100% similarity]
tools/lib/python/kdoc/kdoc_output.py [moved from scripts/lib/kdoc/kdoc_output.py with 100% similarity]
tools/lib/python/kdoc/kdoc_parser.py [moved from scripts/lib/kdoc/kdoc_parser.py with 100% similarity]
tools/lib/python/kdoc/kdoc_re.py [moved from scripts/lib/kdoc/kdoc_re.py with 100% similarity]
tools/lib/python/kdoc/latex_fonts.py [moved from tools/docs/lib/latex_fonts.py with 100% similarity]
tools/lib/python/kdoc/parse_data_structs.py [moved from tools/docs/lib/parse_data_structs.py with 100% similarity]
tools/lib/python/kdoc/python_version.py [moved from tools/docs/lib/python_version.py with 100% similarity]

index 89eaf2100eddc79634a11042cf18846037b1db1b..8c6fc2b628b3e933b51cbbca54b1cf9ce266e12f 100644 (file)
--- a/.pylintrc
+++ b/.pylintrc
@@ -1,2 +1,2 @@
 [MASTER]
-init-hook='import sys; sys.path += ["scripts/lib/kdoc", "scripts/lib/abi", "tools/docs/lib"]'
+init-hook='import sys; sys.path += ["tools/lib/python"]'
index c66df29cf0a32142b9fa6b174298aecf23e0aa47..fda2bef8d9d81cfa2891a6c8adb5f035cfba4faa 100644 (file)
@@ -115,6 +115,6 @@ dochelp:
        @echo  '  make PAPER={a4|letter} Specifies the paper size used for LaTeX/PDF output.'
        @echo
        @echo  '  make FONTS_CONF_DENY_VF={path} sets a deny list to block variable Noto CJK fonts'
-       @echo  '  for PDF build. See tools/docs/lib/latex_fonts.py for more details'
+       @echo  '  for PDF build. See tools/lib/python/kdoc/latex_fonts.py for more details'
        @echo
        @echo  '  Default location for the generated documents is Documentation/output'
index 32e39fb8bc3b317eff65e0e2b8f921d3fa334654..7ec832da84447fd079a861fad3d1be558d18c565 100644 (file)
@@ -43,7 +43,7 @@ from sphinx.util.docutils import switch_source_input
 from sphinx.util import logging
 
 srctree = os.path.abspath(os.environ["srctree"])
-sys.path.insert(0, os.path.join(srctree, "scripts/lib/abi"))
+sys.path.insert(0, os.path.join(srctree, "tools/lib/python/abi"))
 
 from abi_parser import AbiParser
 
index 75e139287d50020b29ffa9297aa802698cffba38..a12455daa6d7a9e8ad9dbe0f3c32e542629c4f33 100755 (executable)
@@ -97,7 +97,7 @@ from docutils.parsers.rst.directives.body import CodeBlock, NumberLines
 from sphinx.util import logging
 
 srctree = os.path.abspath(os.environ["srctree"])
-sys.path.insert(0, os.path.join(srctree, "tools/docs/lib"))
+sys.path.insert(0, os.path.join(srctree, "tools/lib/python/kdoc"))
 
 from parse_data_structs import ParseDataStructs
 
index 2586b4d4e494d774a798c6e186ad303fe1de93e3..56f382a6bdf1c4fe0175204eb25dd00165c66764 100644 (file)
@@ -42,7 +42,7 @@ from sphinx.util import logging
 from pprint import pformat
 
 srctree = os.path.abspath(os.environ["srctree"])
-sys.path.insert(0, os.path.join(srctree, "scripts/lib/kdoc"))
+sys.path.insert(0, os.path.join(srctree, "tools/lib/python/kdoc"))
 
 from kdoc_files import KernelFiles
 from kdoc_output import RestFormat
index 8a9411e5c1e18afdbd057bdad25e0f384c163aca..efe98e680c14a4f021e1483564b1241f2e071b98 100644 (file)
@@ -7412,8 +7412,7 @@ P:        Documentation/doc-guide/maintainer-profile.rst
 T:     git git://git.lwn.net/linux.git docs-next
 F:     Documentation/
 F:     scripts/kernel-doc*
-F:     scripts/lib/abi/*
-F:     scripts/lib/kdoc/*
+F:     tools/lib/python/*
 F:     tools/docs/
 F:     tools/net/ynl/pyynl/lib/doc_generator.py
 X:     Documentation/ABI/
index ae23afd344ec6609286d7d8880c018429af58405..758e947a6fb9067a80ccdb1a847cb510f6e68682 100755 (executable)
@@ -13,7 +13,7 @@ See:
 import os
 import sys
 
-LIB_DIR = "lib"
+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))
index d9fe2bcbd39cc146d4bd632ce52e6b8dab378752..bb24bbf731676557925a47825211323a88de169c 100755 (executable)
@@ -111,7 +111,7 @@ import sys
 
 # Import Python modules
 
-LIB_DIR = "lib/kdoc"
+LIB_DIR = "../tools/lib/python/kdoc"
 SRC_DIR = os.path.dirname(os.path.realpath(__file__))
 
 sys.path.insert(0, os.path.join(SRC_DIR, LIB_DIR))
index c0997d6861dc204d091ae67bbded10f919fa761d..c48bb05dad82f74af24fde4a882ca083af8b808a 100755 (executable)
@@ -9,13 +9,17 @@
 """
 Detect problematic Noto CJK variable fonts.
 
-or more details, see lib/latex_fonts.py.
+or more details, see .../tools/lib/python/kdoc/latex_fonts.py.
 """
 
 import argparse
 import sys
+import os.path
 
-from lib.latex_fonts import LatexFontChecker
+src_dir = os.path.dirname(os.path.realpath(__file__))
+sys.path.insert(0, os.path.join(src_dir, '../lib/python/kdoc'))
+
+from latex_fonts import LatexFontChecker
 
 checker = LatexFontChecker()
 
index da69e77559cc3667c220c39ddc1560bebb9922f7..e0abfe12fac7de493452bd5b560db76a38d78ef3 100755 (executable)
@@ -14,7 +14,7 @@ import sys
 
 # Import Python modules
 
-LIB_DIR = "../../scripts/lib/abi"
+LIB_DIR = "../lib/python/abi"
 SRC_DIR = os.path.dirname(os.path.realpath(__file__))
 
 sys.path.insert(0, os.path.join(SRC_DIR, LIB_DIR))
diff --git a/tools/docs/lib/__init__.py b/tools/docs/lib/__init__.py
deleted file mode 100644 (file)
index e69de29..0000000
index 6716c73002584e09f4c4794de27e9e06aca513b9..ed9cf2bf22de9374f7fd62d7c555a465dc127dca 100755 (executable)
@@ -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/kdoc'))
+from parse_data_structs import ParseDataStructs
+from enrich_formatter import EnrichFormatter
 
 def main():
     """Main function"""
index 1efaca3d16aa901828fc843a51bbdca07e6c651d..ce0b1b5292da0d57f7082410f1109220d1e6c345 100755 (executable)
@@ -56,14 +56,15 @@ import sys
 from concurrent import futures
 from glob import glob
 
-from lib.python_version import PythonVersion
-from lib.latex_fonts import LatexFontChecker
 
-LIB_DIR = "../../scripts/lib"
+LIB_DIR = "../lib/python"
 SRC_DIR = os.path.dirname(os.path.realpath(__file__))
 
 sys.path.insert(0, os.path.join(SRC_DIR, LIB_DIR))
+sys.path.insert(0, os.path.join(SRC_DIR, LIB_DIR + '/kdoc'))  # temporary
 
+from python_version import PythonVersion
+from latex_fonts import LatexFontChecker
 from jobserver import JobserverExec         # pylint: disable=C0413,C0411,E0401
 
 #
index 647e1f60357f1e6ad256d71be2d82fbe45ffb3a6..d8c9fb76948d3b3868bbb30507f69d33c32e7a84 100755 (executable)
@@ -32,8 +32,11 @@ import re
 import subprocess
 import sys
 from glob import glob
+import os.path
 
-from lib.python_version import PythonVersion
+src_dir = os.path.dirname(os.path.realpath(__file__))
+sys.path.insert(0, os.path.join(src_dir, '../lib/python/kdoc'))
+from python_version import PythonVersion
 
 RECOMMENDED_VERSION = PythonVersion("3.4.3").version
 MIN_PYTHON_VERSION = PythonVersion("3.7").version