Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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.

+48 -39
+1 -1
.pylintrc
··· 1 1 [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"]'
+1 -1
Documentation/Makefile
··· 115 115 @echo ' make PAPER={a4|letter} Specifies the paper size used for LaTeX/PDF output.' 116 116 @echo 117 117 @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' 119 119 @echo 120 120 @echo ' Default location for the generated documents is Documentation/output'
+2 -2
Documentation/sphinx/kernel_abi.py
··· 43 43 from sphinx.util import logging 44 44 45 45 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")) 47 47 48 - from abi_parser import AbiParser 48 + from abi.abi_parser import AbiParser 49 49 50 50 __version__ = "1.0" 51 51
+2 -2
Documentation/sphinx/kernel_include.py
··· 97 97 from sphinx.util import logging 98 98 99 99 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")) 101 101 102 - from parse_data_structs import ParseDataStructs 102 + from kdoc.parse_data_structs import ParseDataStructs 103 103 104 104 __version__ = "1.0" 105 105 logger = logging.getLogger(__name__)
+3 -3
Documentation/sphinx/kerneldoc.py
··· 42 42 from pprint import pformat 43 43 44 44 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")) 46 46 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 49 49 50 50 __version__ = '1.0' 51 51 kfiles = None
+1 -2
MAINTAINERS
··· 7412 7412 T: git git://git.lwn.net/linux.git docs-next 7413 7413 F: Documentation/ 7414 7414 F: scripts/kernel-doc* 7415 - F: scripts/lib/abi/* 7416 - F: scripts/lib/kdoc/* 7415 + F: tools/lib/python/* 7417 7416 F: tools/docs/ 7418 7417 F: tools/net/ynl/pyynl/lib/doc_generator.py 7419 7418 X: Documentation/ABI/
+1 -1
scripts/jobserver-exec
··· 13 13 import os 14 14 import sys 15 15 16 - LIB_DIR = "lib" 16 + LIB_DIR = "../tools/lib/python" 17 17 SRC_DIR = os.path.dirname(os.path.realpath(__file__)) 18 18 19 19 sys.path.insert(0, os.path.join(SRC_DIR, LIB_DIR))
+3 -3
scripts/kernel-doc.py
··· 111 111 112 112 # Import Python modules 113 113 114 - LIB_DIR = "lib/kdoc" 114 + LIB_DIR = "../tools/lib/python" 115 115 SRC_DIR = os.path.dirname(os.path.realpath(__file__)) 116 116 117 117 sys.path.insert(0, os.path.join(SRC_DIR, LIB_DIR)) ··· 292 292 logger.warning("Python 3.7 or later is required for correct results") 293 293 294 294 # 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 297 297 298 298 if args.man: 299 299 out_style = ManFormat(modulename=args.modulename)
+1 -1
scripts/lib/abi/abi_parser.py tools/lib/python/abi/abi_parser.py
··· 17 17 18 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 23 class AbiParser:
+2 -2
scripts/lib/abi/abi_regex.py tools/lib/python/abi/abi_regex.py
··· 12 12 13 13 from pprint import pformat 14 14 15 - from abi_parser import AbiParser 16 - from helpers import AbiDebug 15 + from abi.abi_parser import AbiParser 16 + from abi.helpers import AbiDebug 17 17 18 18 class AbiRegex(AbiParser): 19 19 """Extends AbiParser to search ABI nodes with regular expressions"""
scripts/lib/abi/helpers.py tools/lib/python/abi/helpers.py
+1 -1
scripts/lib/abi/system_symbols.py tools/lib/python/abi/system_symbols.py
··· 15 15 from datetime import datetime 16 16 from random import shuffle 17 17 18 - from helpers import AbiDebug 18 + from abi.helpers import AbiDebug 19 19 20 20 class SystemSymbols: 21 21 """Stores arguments for the class and initialize class vars"""
scripts/lib/jobserver.py tools/lib/python/jobserver.py
+2 -2
scripts/lib/kdoc/kdoc_files.py tools/lib/python/kdoc/kdoc_files.py
··· 13 13 import os 14 14 import re 15 15 16 - from kdoc_parser import KernelDoc 17 - from kdoc_output import OutputFormat 16 + from kdoc.kdoc_parser import KernelDoc 17 + from kdoc.kdoc_output import OutputFormat 18 18 19 19 20 20 class GlobSourceFiles:
scripts/lib/kdoc/kdoc_item.py tools/lib/python/kdoc/kdoc_item.py
+2 -2
scripts/lib/kdoc/kdoc_output.py tools/lib/python/kdoc/kdoc_output.py
··· 19 19 import re 20 20 from datetime import datetime 21 21 22 - from kdoc_parser import KernelDoc, type_param 23 - from kdoc_re import KernRe 22 + from kdoc.kdoc_parser import KernelDoc, type_param 23 + from kdoc.kdoc_re import KernRe 24 24 25 25 26 26 function_pointer = KernRe(r"([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)", cache=False)
+2 -2
scripts/lib/kdoc/kdoc_parser.py tools/lib/python/kdoc/kdoc_parser.py
··· 16 16 import re 17 17 from pprint import pformat 18 18 19 - from kdoc_re import NestedMatch, KernRe 20 - from kdoc_item import KdocItem 19 + from kdoc.kdoc_re import NestedMatch, KernRe 20 + from kdoc.kdoc_item import KdocItem 21 21 22 22 # 23 23 # Regular expressions used to parse kernel-doc markups at KernelDoc class.
scripts/lib/kdoc/kdoc_re.py tools/lib/python/kdoc/kdoc_re.py
+6 -2
tools/docs/check-variable-fonts.py
··· 9 9 """ 10 10 Detect problematic Noto CJK variable fonts. 11 11 12 - or more details, see lib/latex_fonts.py. 12 + or more details, see .../tools/lib/python/kdoc/latex_fonts.py. 13 13 """ 14 14 15 15 import argparse 16 16 import sys 17 + import os.path 17 18 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 19 23 20 24 checker = LatexFontChecker() 21 25
+5 -5
tools/docs/get_abi.py
··· 14 14 15 15 # Import Python modules 16 16 17 - LIB_DIR = "../../scripts/lib/abi" 17 + LIB_DIR = "../lib/python" 18 18 SRC_DIR = os.path.dirname(os.path.realpath(__file__)) 19 19 20 20 sys.path.insert(0, os.path.join(SRC_DIR, LIB_DIR)) 21 21 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 26 26 27 27 # Command line classes 28 28
tools/docs/lib/__init__.py tools/lib/python/__init__.py
tools/docs/lib/enrich_formatter.py tools/lib/python/kdoc/enrich_formatter.py
tools/docs/lib/latex_fonts.py tools/lib/python/kdoc/latex_fonts.py
tools/docs/lib/parse_data_structs.py tools/lib/python/kdoc/parse_data_structs.py
tools/docs/lib/python_version.py tools/lib/python/kdoc/python_version.py
+6 -3
tools/docs/parse-headers.py
··· 24 24 replace define V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ :c:type:`v4l2_event_motion_det` 25 25 """ 26 26 27 - import argparse 27 + import argparse, sys 28 + import os.path 28 29 29 - from lib.parse_data_structs import ParseDataStructs 30 - from lib.enrich_formatter import EnrichFormatter 30 + src_dir = os.path.dirname(os.path.realpath(__file__)) 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 31 34 32 35 def main(): 33 36 """Main function"""
+3 -3
tools/docs/sphinx-build-wrapper
··· 56 56 from concurrent import futures 57 57 from glob import glob 58 58 59 - from lib.python_version import PythonVersion 60 - from lib.latex_fonts import LatexFontChecker 61 59 62 - LIB_DIR = "../../scripts/lib" 60 + LIB_DIR = "../lib/python" 63 61 SRC_DIR = os.path.dirname(os.path.realpath(__file__)) 64 62 65 63 sys.path.insert(0, os.path.join(SRC_DIR, LIB_DIR)) 66 64 65 + from kdoc.python_version import PythonVersion 66 + from kdoc.latex_fonts import LatexFontChecker 67 67 from jobserver import JobserverExec # pylint: disable=C0413,C0411,E0401 68 68 69 69 #
+4 -1
tools/docs/sphinx-pre-install
··· 32 32 import subprocess 33 33 import sys 34 34 from glob import glob 35 + import os.path 35 36 36 - from lib.python_version import PythonVersion 37 + src_dir = os.path.dirname(os.path.realpath(__file__)) 38 + sys.path.insert(0, os.path.join(src_dir, '../lib/python')) 39 + from kdoc.python_version import PythonVersion 37 40 38 41 RECOMMENDED_VERSION = PythonVersion("3.4.3").version 39 42 MIN_PYTHON_VERSION = PythonVersion("3.7").version
tools/lib/python/abi/__init__.py
tools/lib/python/kdoc/__init__.py