docs: Move the python libraries to tools/lib/python

"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>
This commit is contained in:
Jonathan Corbet committed 2025-11-18 09:22:40 -07:00
1 parent f690e07859
commit 778b8ebe51
28 files changed
+29 -19

No files matched your search

+1 -1
View File
@@ -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"]'
+1 -1
View 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'
+1 -1
View 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
+1 -1
View File
@@ -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
+1 -1
View 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
+1 -2
View 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/
+1 -1
View File
@@ -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))
+1 -1
View File
@@ -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))
+6 -2
View File
@@ -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()
+1 -1
View File
@@ -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))
View File
Whitespace-only changes.
+6 -3
View File
@@ -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"""
+4 -3
View File
@@ -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
#
+4 -1
View File
@@ -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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.