Skip to content

Commit 992a9df

Browse files
author
Jonathan Corbet
committed
docs: bring some order to our Python module hierarchy
Now that we have tools/lib/python for our Python modules, turn them into proper packages with a single namespace so that everything can just use tools/lib/python in sys.path. No functional change. Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <20251110220430.726665-3-corbet@lwn.net>
1 parent 778b8eb commit 992a9df

18 files changed

Lines changed: 34 additions & 35 deletions

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, "tools/lib/python/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/lib/python/kdoc"))
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, "tools/lib/python/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

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 = "../tools/lib/python/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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
import os.path
1818

1919
src_dir = os.path.dirname(os.path.realpath(__file__))
20-
sys.path.insert(0, os.path.join(src_dir, '../lib/python/kdoc'))
20+
sys.path.insert(0, os.path.join(src_dir, '../lib/python'))
2121

22-
from latex_fonts import LatexFontChecker
22+
from kdoc.latex_fonts import LatexFontChecker
2323

2424
checker = LatexFontChecker()
2525

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 = "../lib/python/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

tools/docs/parse-headers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
import os.path
2929

3030
src_dir = os.path.dirname(os.path.realpath(__file__))
31-
sys.path.insert(0, os.path.join(src_dir, '../lib/python/kdoc'))
32-
from parse_data_structs import ParseDataStructs
33-
from enrich_formatter import EnrichFormatter
31+
sys.path.insert(0, os.path.join(src_dir, '../lib/python'))
32+
from kdoc.parse_data_structs import ParseDataStructs
33+
from kdoc.enrich_formatter import EnrichFormatter
3434

3535
def main():
3636
"""Main function"""

tools/docs/sphinx-build-wrapper

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,9 @@ LIB_DIR = "../lib/python"
6161
SRC_DIR = os.path.dirname(os.path.realpath(__file__))
6262

6363
sys.path.insert(0, os.path.join(SRC_DIR, LIB_DIR))
64-
sys.path.insert(0, os.path.join(SRC_DIR, LIB_DIR + '/kdoc')) # temporary
6564

66-
from python_version import PythonVersion
67-
from latex_fonts import LatexFontChecker
65+
from kdoc.python_version import PythonVersion
66+
from kdoc.latex_fonts import LatexFontChecker
6867
from jobserver import JobserverExec # pylint: disable=C0413,C0411,E0401
6968

7069
#

tools/docs/sphinx-pre-install

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ from glob import glob
3535
import os.path
3636

3737
src_dir = os.path.dirname(os.path.realpath(__file__))
38-
sys.path.insert(0, os.path.join(src_dir, '../lib/python/kdoc'))
39-
from python_version import PythonVersion
38+
sys.path.insert(0, os.path.join(src_dir, '../lib/python'))
39+
from kdoc.python_version import PythonVersion
4040

4141
RECOMMENDED_VERSION = PythonVersion("3.4.3").version
4242
MIN_PYTHON_VERSION = PythonVersion("3.7").version

tools/lib/python/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)