mirror of https://github.com/torvalds/linux.git
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>
This commit is contained in:
parent
778b8ebe51
commit
992a9df41a
|
|
@ -43,9 +43,9 @@ from sphinx.util.docutils import switch_source_input
|
||||||
from sphinx.util import logging
|
from sphinx.util import logging
|
||||||
|
|
||||||
srctree = os.path.abspath(os.environ["srctree"])
|
srctree = os.path.abspath(os.environ["srctree"])
|
||||||
sys.path.insert(0, os.path.join(srctree, "tools/lib/python/abi"))
|
sys.path.insert(0, os.path.join(srctree, "tools/lib/python"))
|
||||||
|
|
||||||
from abi_parser import AbiParser
|
from abi.abi_parser import AbiParser
|
||||||
|
|
||||||
__version__ = "1.0"
|
__version__ = "1.0"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -97,9 +97,9 @@ from docutils.parsers.rst.directives.body import CodeBlock, NumberLines
|
||||||
from sphinx.util import logging
|
from sphinx.util import logging
|
||||||
|
|
||||||
srctree = os.path.abspath(os.environ["srctree"])
|
srctree = os.path.abspath(os.environ["srctree"])
|
||||||
sys.path.insert(0, os.path.join(srctree, "tools/lib/python/kdoc"))
|
sys.path.insert(0, os.path.join(srctree, "tools/lib/python"))
|
||||||
|
|
||||||
from parse_data_structs import ParseDataStructs
|
from kdoc.parse_data_structs import ParseDataStructs
|
||||||
|
|
||||||
__version__ = "1.0"
|
__version__ = "1.0"
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
|
||||||
|
|
@ -42,10 +42,10 @@ from sphinx.util import logging
|
||||||
from pprint import pformat
|
from pprint import pformat
|
||||||
|
|
||||||
srctree = os.path.abspath(os.environ["srctree"])
|
srctree = os.path.abspath(os.environ["srctree"])
|
||||||
sys.path.insert(0, os.path.join(srctree, "tools/lib/python/kdoc"))
|
sys.path.insert(0, os.path.join(srctree, "tools/lib/python"))
|
||||||
|
|
||||||
from kdoc_files import KernelFiles
|
from kdoc.kdoc_files import KernelFiles
|
||||||
from kdoc_output import RestFormat
|
from kdoc.kdoc_output import RestFormat
|
||||||
|
|
||||||
__version__ = '1.0'
|
__version__ = '1.0'
|
||||||
kfiles = None
|
kfiles = None
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ import sys
|
||||||
|
|
||||||
# Import Python modules
|
# Import Python modules
|
||||||
|
|
||||||
LIB_DIR = "../tools/lib/python/kdoc"
|
LIB_DIR = "../tools/lib/python"
|
||||||
SRC_DIR = os.path.dirname(os.path.realpath(__file__))
|
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))
|
||||||
|
|
@ -292,8 +292,8 @@ def main():
|
||||||
logger.warning("Python 3.7 or later is required for correct results")
|
logger.warning("Python 3.7 or later is required for correct results")
|
||||||
|
|
||||||
# Import kernel-doc libraries only after checking Python version
|
# Import kernel-doc libraries only after checking Python version
|
||||||
from kdoc_files import KernelFiles # pylint: disable=C0415
|
from kdoc.kdoc_files import KernelFiles # pylint: disable=C0415
|
||||||
from kdoc_output import RestFormat, ManFormat # pylint: disable=C0415
|
from kdoc.kdoc_output import RestFormat, ManFormat # pylint: disable=C0415
|
||||||
|
|
||||||
if args.man:
|
if args.man:
|
||||||
out_style = ManFormat(modulename=args.modulename)
|
out_style = ManFormat(modulename=args.modulename)
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,9 @@ import sys
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
src_dir = os.path.dirname(os.path.realpath(__file__))
|
src_dir = os.path.dirname(os.path.realpath(__file__))
|
||||||
sys.path.insert(0, os.path.join(src_dir, '../lib/python/kdoc'))
|
sys.path.insert(0, os.path.join(src_dir, '../lib/python'))
|
||||||
|
|
||||||
from latex_fonts import LatexFontChecker
|
from kdoc.latex_fonts import LatexFontChecker
|
||||||
|
|
||||||
checker = LatexFontChecker()
|
checker = LatexFontChecker()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,15 +14,15 @@ import sys
|
||||||
|
|
||||||
# Import Python modules
|
# Import Python modules
|
||||||
|
|
||||||
LIB_DIR = "../lib/python/abi"
|
LIB_DIR = "../lib/python"
|
||||||
SRC_DIR = os.path.dirname(os.path.realpath(__file__))
|
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))
|
||||||
|
|
||||||
from abi_parser import AbiParser # pylint: disable=C0413
|
from abi.abi_parser import AbiParser # pylint: disable=C0413
|
||||||
from abi_regex import AbiRegex # pylint: disable=C0413
|
from abi.abi_regex import AbiRegex # pylint: disable=C0413
|
||||||
from helpers import ABI_DIR, DEBUG_HELP # pylint: disable=C0413
|
from abi.helpers import ABI_DIR, DEBUG_HELP # pylint: disable=C0413
|
||||||
from system_symbols import SystemSymbols # pylint: disable=C0413
|
from abi.system_symbols import SystemSymbols # pylint: disable=C0413
|
||||||
|
|
||||||
# Command line classes
|
# Command line classes
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,9 @@ import argparse, sys
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
src_dir = os.path.dirname(os.path.realpath(__file__))
|
src_dir = os.path.dirname(os.path.realpath(__file__))
|
||||||
sys.path.insert(0, os.path.join(src_dir, '../lib/python/kdoc'))
|
sys.path.insert(0, os.path.join(src_dir, '../lib/python'))
|
||||||
from parse_data_structs import ParseDataStructs
|
from kdoc.parse_data_structs import ParseDataStructs
|
||||||
from enrich_formatter import EnrichFormatter
|
from kdoc.enrich_formatter import EnrichFormatter
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""Main function"""
|
"""Main function"""
|
||||||
|
|
|
||||||
|
|
@ -61,10 +61,9 @@ LIB_DIR = "../lib/python"
|
||||||
SRC_DIR = os.path.dirname(os.path.realpath(__file__))
|
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))
|
||||||
sys.path.insert(0, os.path.join(SRC_DIR, LIB_DIR + '/kdoc')) # temporary
|
|
||||||
|
|
||||||
from python_version import PythonVersion
|
from kdoc.python_version import PythonVersion
|
||||||
from latex_fonts import LatexFontChecker
|
from kdoc.latex_fonts import LatexFontChecker
|
||||||
from jobserver import JobserverExec # pylint: disable=C0413,C0411,E0401
|
from jobserver import JobserverExec # pylint: disable=C0413,C0411,E0401
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,8 @@ from glob import glob
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
src_dir = os.path.dirname(os.path.realpath(__file__))
|
src_dir = os.path.dirname(os.path.realpath(__file__))
|
||||||
sys.path.insert(0, os.path.join(src_dir, '../lib/python/kdoc'))
|
sys.path.insert(0, os.path.join(src_dir, '../lib/python'))
|
||||||
from python_version import PythonVersion
|
from kdoc.python_version import PythonVersion
|
||||||
|
|
||||||
RECOMMENDED_VERSION = PythonVersion("3.4.3").version
|
RECOMMENDED_VERSION = PythonVersion("3.4.3").version
|
||||||
MIN_PYTHON_VERSION = PythonVersion("3.7").version
|
MIN_PYTHON_VERSION = PythonVersion("3.7").version
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ from random import randrange, seed
|
||||||
|
|
||||||
# Import Python modules
|
# Import Python modules
|
||||||
|
|
||||||
from helpers import AbiDebug, ABI_DIR
|
from abi.helpers import AbiDebug, ABI_DIR
|
||||||
|
|
||||||
|
|
||||||
class AbiParser:
|
class AbiParser:
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,8 @@ import sys
|
||||||
|
|
||||||
from pprint import pformat
|
from pprint import pformat
|
||||||
|
|
||||||
from abi_parser import AbiParser
|
from abi.abi_parser import AbiParser
|
||||||
from helpers import AbiDebug
|
from abi.helpers import AbiDebug
|
||||||
|
|
||||||
class AbiRegex(AbiParser):
|
class AbiRegex(AbiParser):
|
||||||
"""Extends AbiParser to search ABI nodes with regular expressions"""
|
"""Extends AbiParser to search ABI nodes with regular expressions"""
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ from concurrent import futures
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from random import shuffle
|
from random import shuffle
|
||||||
|
|
||||||
from helpers import AbiDebug
|
from abi.helpers import AbiDebug
|
||||||
|
|
||||||
class SystemSymbols:
|
class SystemSymbols:
|
||||||
"""Stores arguments for the class and initialize class vars"""
|
"""Stores arguments for the class and initialize class vars"""
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,8 @@ import logging
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from kdoc_parser import KernelDoc
|
from kdoc.kdoc_parser import KernelDoc
|
||||||
from kdoc_output import OutputFormat
|
from kdoc.kdoc_output import OutputFormat
|
||||||
|
|
||||||
|
|
||||||
class GlobSourceFiles:
|
class GlobSourceFiles:
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@ import os
|
||||||
import re
|
import re
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from kdoc_parser import KernelDoc, type_param
|
from kdoc.kdoc_parser import KernelDoc, type_param
|
||||||
from kdoc_re import KernRe
|
from kdoc.kdoc_re import KernRe
|
||||||
|
|
||||||
|
|
||||||
function_pointer = KernRe(r"([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)", cache=False)
|
function_pointer = KernRe(r"([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)", cache=False)
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,8 @@ import sys
|
||||||
import re
|
import re
|
||||||
from pprint import pformat
|
from pprint import pformat
|
||||||
|
|
||||||
from kdoc_re import NestedMatch, KernRe
|
from kdoc.kdoc_re import NestedMatch, KernRe
|
||||||
from kdoc_item import KdocItem
|
from kdoc.kdoc_item import KdocItem
|
||||||
|
|
||||||
#
|
#
|
||||||
# Regular expressions used to parse kernel-doc markups at KernelDoc class.
|
# Regular expressions used to parse kernel-doc markups at KernelDoc class.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue