Skip to content

Commit 34a2824

Browse files
author
Jonathan Corbet
committed
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.
2 parents f690e07 + 992a9df commit 34a2824

30 files changed

Lines changed: 48 additions & 39 deletions

.pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[MASTER]
2-
init-hook='import sys; sys.path += ["scripts/lib/kdoc", "scripts/lib/abi", "tools/docs/lib"]'
2+
init-hook='import sys; sys.path += ["tools/lib/python"]'

Documentation/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,6 @@ dochelp:
115115
@echo ' make PAPER={a4|letter} Specifies the paper size used for LaTeX/PDF output.'
116116
@echo
117117
@echo ' make FONTS_CONF_DENY_VF={path} sets a deny list to block variable Noto CJK fonts'
118-
@echo ' for PDF build. See tools/docs/lib/latex_fonts.py for more details'
118+
@echo ' for PDF build. See tools/lib/python/kdoc/latex_fonts.py for more details'
119119
@echo
120120
@echo ' Default location for the generated documents is Documentation/output'

Documentation/sphinx/kernel_abi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@
4343
from sphinx.util import logging
4444

4545
srctree = os.path.abspath(os.environ["srctree"])
46-
sys.path.insert(0, os.path.join(srctree, "scripts/lib/abi"))
46+
sys.path.insert(0, os.path.join(srctree, "tools/lib/python"))
4747

48-
from abi_parser import AbiParser
48+
from abi.abi_parser import AbiParser
4949

5050
__version__ = "1.0"
5151

Documentation/sphinx/kernel_include.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@
9797
from sphinx.util import logging
9898

9999
srctree = os.path.abspath(os.environ["srctree"])
100-
sys.path.insert(0, os.path.join(srctree, "tools/docs/lib"))
100+
sys.path.insert(0, os.path.join(srctree, "tools/lib/python"))
101101

102-
from parse_data_structs import ParseDataStructs
102+
from kdoc.parse_data_structs import ParseDataStructs
103103

104104
__version__ = "1.0"
105105
logger = logging.getLogger(__name__)

Documentation/sphinx/kerneldoc.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@
4242
from pprint import pformat
4343

4444
srctree = os.path.abspath(os.environ["srctree"])
45-
sys.path.insert(0, os.path.join(srctree, "scripts/lib/kdoc"))
45+
sys.path.insert(0, os.path.join(srctree, "tools/lib/python"))
4646

47-
from kdoc_files import KernelFiles
48-
from kdoc_output import RestFormat
47+
from kdoc.kdoc_files import KernelFiles
48+
from kdoc.kdoc_output import RestFormat
4949

5050
__version__ = '1.0'
5151
kfiles = None

MAINTAINERS

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7412,8 +7412,7 @@ P: Documentation/doc-guide/maintainer-profile.rst
74127412
T: git git://git.lwn.net/linux.git docs-next
74137413
F: Documentation/
74147414
F: scripts/kernel-doc*
7415-
F: scripts/lib/abi/*
7416-
F: scripts/lib/kdoc/*
7415+
F: tools/lib/python/*
74177416
F: tools/docs/
74187417
F: tools/net/ynl/pyynl/lib/doc_generator.py
74197418
X: Documentation/ABI/

scripts/jobserver-exec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ See:
1313
import os
1414
import sys
1515

16-
LIB_DIR = "lib"
16+
LIB_DIR = "../tools/lib/python"
1717
SRC_DIR = os.path.dirname(os.path.realpath(__file__))
1818

1919
sys.path.insert(0, os.path.join(SRC_DIR, LIB_DIR))

scripts/kernel-doc.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111

112112
# Import Python modules
113113

114-
LIB_DIR = "lib/kdoc"
114+
LIB_DIR = "../tools/lib/python"
115115
SRC_DIR = os.path.dirname(os.path.realpath(__file__))
116116

117117
sys.path.insert(0, os.path.join(SRC_DIR, LIB_DIR))
@@ -292,8 +292,8 @@ def main():
292292
logger.warning("Python 3.7 or later is required for correct results")
293293

294294
# Import kernel-doc libraries only after checking Python version
295-
from kdoc_files import KernelFiles # pylint: disable=C0415
296-
from kdoc_output import RestFormat, ManFormat # pylint: disable=C0415
295+
from kdoc.kdoc_files import KernelFiles # pylint: disable=C0415
296+
from kdoc.kdoc_output import RestFormat, ManFormat # pylint: disable=C0415
297297

298298
if args.man:
299299
out_style = ManFormat(modulename=args.modulename)

tools/docs/check-variable-fonts.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,17 @@
99
"""
1010
Detect problematic Noto CJK variable fonts.
1111
12-
or more details, see lib/latex_fonts.py.
12+
or more details, see .../tools/lib/python/kdoc/latex_fonts.py.
1313
"""
1414

1515
import argparse
1616
import sys
17+
import os.path
1718

18-
from lib.latex_fonts import LatexFontChecker
19+
src_dir = os.path.dirname(os.path.realpath(__file__))
20+
sys.path.insert(0, os.path.join(src_dir, '../lib/python'))
21+
22+
from kdoc.latex_fonts import LatexFontChecker
1923

2024
checker = LatexFontChecker()
2125

tools/docs/get_abi.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414

1515
# Import Python modules
1616

17-
LIB_DIR = "../../scripts/lib/abi"
17+
LIB_DIR = "../lib/python"
1818
SRC_DIR = os.path.dirname(os.path.realpath(__file__))
1919

2020
sys.path.insert(0, os.path.join(SRC_DIR, LIB_DIR))
2121

22-
from abi_parser import AbiParser # pylint: disable=C0413
23-
from abi_regex import AbiRegex # pylint: disable=C0413
24-
from helpers import ABI_DIR, DEBUG_HELP # pylint: disable=C0413
25-
from system_symbols import SystemSymbols # pylint: disable=C0413
22+
from abi.abi_parser import AbiParser # pylint: disable=C0413
23+
from abi.abi_regex import AbiRegex # pylint: disable=C0413
24+
from abi.helpers import ABI_DIR, DEBUG_HELP # pylint: disable=C0413
25+
from abi.system_symbols import SystemSymbols # pylint: disable=C0413
2626

2727
# Command line classes
2828

0 commit comments

Comments
 (0)