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.
Unified · Split
| @@ -43,9 +43,9 @@ from sphinx.util.docutils import switch_source_input · 42 unmodified lines | |||
| 43 | from sphinx.util import logging | 43 | from sphinx.util import logging |
| 44 | 44 | ||
| 45 | srctree = os.path.abspath(os.environ["srctree"]) | 45 | 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")) |
| 47 | 47 | ||
| 48 | from abi_parser import AbiParser | 48 | from abi.abi_parser import AbiParser |
| 49 | 49 | ||
| 50 | __version__ = "1.0" | 50 | __version__ = "1.0" |
| 51 | 51 | ||
| @@ -97,9 +97,9 @@ from docutils.parsers.rst.directives.body import CodeBlock, NumberLines · 96 unmodified lines | |||
| 97 | from sphinx.util import logging | 97 | from sphinx.util import logging |
| 98 | 98 | ||
| 99 | srctree = os.path.abspath(os.environ["srctree"]) | 99 | 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")) |
| 101 | 101 | ||
| 102 | from parse_data_structs import ParseDataStructs | 102 | from kdoc.parse_data_structs import ParseDataStructs |
| 103 | 103 | ||
| 104 | __version__ = "1.0" | 104 | __version__ = "1.0" |
| 105 | logger = logging.getLogger(__name__) | 105 | logger = logging.getLogger(__name__) |
| @@ -42,10 +42,10 @@ from sphinx.util import logging · 41 unmodified lines | |||
| 42 | from pprint import pformat | 42 | from pprint import pformat |
| 43 | 43 | ||
| 44 | srctree = os.path.abspath(os.environ["srctree"]) | 44 | 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")) |
| 46 | 46 | ||
| 47 | from kdoc_files import KernelFiles | 47 | from kdoc.kdoc_files import KernelFiles |
| 48 | from kdoc_output import RestFormat | 48 | from kdoc.kdoc_output import RestFormat |
| 49 | 49 | ||
| 50 | __version__ = '1.0' | 50 | __version__ = '1.0' |
| 51 | kfiles = None | 51 | kfiles = None |
| @@ -111,7 +111,7 @@ import sys · 110 unmodified lines | |||
| 111 | 111 | ||
| 112 | # Import Python modules | 112 | # Import Python modules |
| 113 | 113 | ||
| 114 | LIB_DIR = "../tools/lib/python/kdoc" | 114 | LIB_DIR = "../tools/lib/python" |
| 115 | SRC_DIR = os.path.dirname(os.path.realpath(__file__)) | 115 | SRC_DIR = os.path.dirname(os.path.realpath(__file__)) |
| 116 | 116 | ||
| 117 | sys.path.insert(0, os.path.join(SRC_DIR, LIB_DIR)) | 117 | sys.path.insert(0, os.path.join(SRC_DIR, LIB_DIR)) |
| @@ -292,8 +292,8 @@ def main(): · 174 unmodified lines | |||
| 292 | logger.warning("Python 3.7 or later is required for correct results") | 292 | logger.warning("Python 3.7 or later is required for correct results") |
| 293 | 293 | ||
| 294 | # Import kernel-doc libraries only after checking Python version | 294 | # Import kernel-doc libraries only after checking Python version |
| 295 | from kdoc_files import KernelFiles # pylint: disable=C0415 | 295 | from kdoc.kdoc_files import KernelFiles # pylint: disable=C0415 |
| 296 | from kdoc_output import RestFormat, ManFormat # pylint: disable=C0415 | 296 | from kdoc.kdoc_output import RestFormat, ManFormat # pylint: disable=C0415 |
| 297 | 297 | ||
| 298 | if args.man: | 298 | if args.man: |
| 299 | out_style = ManFormat(modulename=args.modulename) | 299 | out_style = ManFormat(modulename=args.modulename) |
| @@ -17,9 +17,9 @@ import sys · 16 unmodified lines | |||
| 17 | import os.path | 17 | import os.path |
| 18 | 18 | ||
| 19 | src_dir = os.path.dirname(os.path.realpath(__file__)) | 19 | 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')) |
| 21 | 21 | ||
| 22 | from latex_fonts import LatexFontChecker | 22 | from kdoc.latex_fonts import LatexFontChecker |
| 23 | 23 | ||
| 24 | checker = LatexFontChecker() | 24 | checker = LatexFontChecker() |
| 25 | 25 | ||
| @@ -14,15 +14,15 @@ import sys · 13 unmodified lines | |||
| 14 | 14 | ||
| 15 | # Import Python modules | 15 | # Import Python modules |
| 16 | 16 | ||
| 17 | LIB_DIR = "../lib/python/abi" | 17 | LIB_DIR = "../lib/python" |
| 18 | SRC_DIR = os.path.dirname(os.path.realpath(__file__)) | 18 | SRC_DIR = os.path.dirname(os.path.realpath(__file__)) |
| 19 | 19 | ||
| 20 | sys.path.insert(0, os.path.join(SRC_DIR, LIB_DIR)) | 20 | sys.path.insert(0, os.path.join(SRC_DIR, LIB_DIR)) |
| 21 | 21 | ||
| 22 | from abi_parser import AbiParser # pylint: disable=C0413 | 22 | from abi.abi_parser import AbiParser # pylint: disable=C0413 |
| 23 | from abi_regex import AbiRegex # pylint: disable=C0413 | 23 | from abi.abi_regex import AbiRegex # pylint: disable=C0413 |
| 24 | from helpers import ABI_DIR, DEBUG_HELP # pylint: disable=C0413 | 24 | from abi.helpers import ABI_DIR, DEBUG_HELP # pylint: disable=C0413 |
| 25 | from system_symbols import SystemSymbols # pylint: disable=C0413 | 25 | from abi.system_symbols import SystemSymbols # pylint: disable=C0413 |
| 26 | 26 | ||
| 27 | # Command line classes | 27 | # Command line classes |
| 28 | 28 | ||
| @@ -28,9 +28,9 @@ import argparse, sys · 27 unmodified lines | |||
| 28 | import os.path | 28 | import os.path |
| 29 | 29 | ||
| 30 | src_dir = os.path.dirname(os.path.realpath(__file__)) | 30 | src_dir = os.path.dirname(os.path.realpath(__file__)) |
| 31 | sys.path.insert(0, os.path.join(src_dir, '../lib/python/kdoc')) | 31 | sys.path.insert(0, os.path.join(src_dir, '../lib/python')) |
| 32 | from parse_data_structs import ParseDataStructs | 32 | from kdoc.parse_data_structs import ParseDataStructs |
| 33 | from enrich_formatter import EnrichFormatter | 33 | from kdoc.enrich_formatter import EnrichFormatter |
| 34 | 34 | ||
| 35 | def main(): | 35 | def main(): |
| 36 | """Main function""" | 36 | """Main function""" |
| @@ -61,10 +61,9 @@ LIB_DIR = "../lib/python" · 60 unmodified lines | |||
| 61 | SRC_DIR = os.path.dirname(os.path.realpath(__file__)) | 61 | SRC_DIR = os.path.dirname(os.path.realpath(__file__)) |
| 62 | 62 | ||
| 63 | sys.path.insert(0, os.path.join(SRC_DIR, LIB_DIR)) | 63 | 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 | ||
| 65 | 64 | ||
| 66 | from python_version import PythonVersion | 65 | from kdoc.python_version import PythonVersion |
| 67 | from latex_fonts import LatexFontChecker | 66 | from kdoc.latex_fonts import LatexFontChecker |
| 68 | from jobserver import JobserverExec # pylint: disable=C0413,C0411,E0401 | 67 | from jobserver import JobserverExec # pylint: disable=C0413,C0411,E0401 |
| 69 | 68 | ||
| 70 | # | 69 | # |
| @@ -35,8 +35,8 @@ from glob import glob · 34 unmodified lines | |||
| 35 | import os.path | 35 | import os.path |
| 36 | 36 | ||
| 37 | src_dir = os.path.dirname(os.path.realpath(__file__)) | 37 | src_dir = os.path.dirname(os.path.realpath(__file__)) |
| 38 | sys.path.insert(0, os.path.join(src_dir, '../lib/python/kdoc')) | 38 | sys.path.insert(0, os.path.join(src_dir, '../lib/python')) |
| 39 | from python_version import PythonVersion | 39 | from kdoc.python_version import PythonVersion |
| 40 | 40 | ||
| 41 | RECOMMENDED_VERSION = PythonVersion("3.4.3").version | 41 | RECOMMENDED_VERSION = PythonVersion("3.4.3").version |
| 42 | MIN_PYTHON_VERSION = PythonVersion("3.7").version | 42 | MIN_PYTHON_VERSION = PythonVersion("3.7").version |
Empty file added.
Empty file added.
| @@ -17,7 +17,7 @@ from random import randrange, seed · 16 unmodified lines | |||
| 17 | 17 | ||
| 18 | # Import Python modules | 18 | # Import Python modules |
| 19 | 19 | ||
| 20 | from helpers import AbiDebug, ABI_DIR | 20 | from abi.helpers import AbiDebug, ABI_DIR |
| 21 | 21 | ||
| 22 | 22 | ||
| 23 | class AbiParser: | 23 | class AbiParser: |
| @@ -12,8 +12,8 @@ import sys · 11 unmodified lines | |||
| 12 | 12 | ||
| 13 | from pprint import pformat | 13 | from pprint import pformat |
| 14 | 14 | ||
| 15 | from abi_parser import AbiParser | 15 | from abi.abi_parser import AbiParser |
| 16 | from helpers import AbiDebug | 16 | from abi.helpers import AbiDebug |
| 17 | 17 | ||
| 18 | class AbiRegex(AbiParser): | 18 | class AbiRegex(AbiParser): |
| 19 | """Extends AbiParser to search ABI nodes with regular expressions""" | 19 | """Extends AbiParser to search ABI nodes with regular expressions""" |
| @@ -15,7 +15,7 @@ from concurrent import futures · 14 unmodified lines | |||
| 15 | from datetime import datetime | 15 | from datetime import datetime |
| 16 | from random import shuffle | 16 | from random import shuffle |
| 17 | 17 | ||
| 18 | from helpers import AbiDebug | 18 | from abi.helpers import AbiDebug |
| 19 | 19 | ||
| 20 | class SystemSymbols: | 20 | class SystemSymbols: |
| 21 | """Stores arguments for the class and initialize class vars""" | 21 | """Stores arguments for the class and initialize class vars""" |
Empty file added.
| @@ -13,8 +13,8 @@ import logging · 12 unmodified lines | |||
| 13 | import os | 13 | import os |
| 14 | import re | 14 | import re |
| 15 | 15 | ||
| 16 | from kdoc_parser import KernelDoc | 16 | from kdoc.kdoc_parser import KernelDoc |
| 17 | from kdoc_output import OutputFormat | 17 | from kdoc.kdoc_output import OutputFormat |
| 18 | 18 | ||
| 19 | 19 | ||
| 20 | class GlobSourceFiles: | 20 | class GlobSourceFiles: |
| @@ -19,8 +19,8 @@ import os · 18 unmodified lines | |||
| 19 | import re | 19 | import re |
| 20 | from datetime import datetime | 20 | from datetime import datetime |
| 21 | 21 | ||
| 22 | from kdoc_parser import KernelDoc, type_param | 22 | from kdoc.kdoc_parser import KernelDoc, type_param |
| 23 | from kdoc_re import KernRe | 23 | from kdoc.kdoc_re import KernRe |
| 24 | 24 | ||
| 25 | 25 | ||
| 26 | function_pointer = KernRe(r"([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)", cache=False) | 26 | function_pointer = KernRe(r"([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)", cache=False) |
| @@ -16,8 +16,8 @@ import sys · 15 unmodified lines | |||
| 16 | import re | 16 | import re |
| 17 | from pprint import pformat | 17 | from pprint import pformat |
| 18 | 18 | ||
| 19 | from kdoc_re import NestedMatch, KernRe | 19 | from kdoc.kdoc_re import NestedMatch, KernRe |
| 20 | from kdoc_item import KdocItem | 20 | from kdoc.kdoc_item import KdocItem |
| 21 | 21 | ||
| 22 | # | 22 | # |
| 23 | # Regular expressions used to parse kernel-doc markups at KernelDoc class. | 23 | # Regular expressions used to parse kernel-doc markups at KernelDoc class. |