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.

docs: sphinx: kerneldoc: verbose kernel-doc command if V=1

It is useful to know what kernel-doc command was used during
document build time, as it allows one to check the output the same
way as Sphinx extension does.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Link: https://lore.kernel.org/r/a2f01590814b111e138f278e8a721024fdf2d445.1744106242.git.mchehab+huawei@kernel.org

authored by

Mauro Carvalho Chehab and committed by
Jonathan Corbet
668b9d1d 02df8e3b

+34
+34
Documentation/sphinx/kerneldoc.py
··· 43 43 44 44 __version__ = '1.0' 45 45 46 + def cmd_str(cmd): 47 + """ 48 + Helper function to output a command line that can be used to produce 49 + the same records via command line. Helpful to debug troubles at the 50 + script. 51 + """ 52 + 53 + cmd_line = "" 54 + 55 + for w in cmd: 56 + if w == "" or " " in w: 57 + esc_cmd = "'" + w + "'" 58 + else: 59 + esc_cmd = w 60 + 61 + if cmd_line: 62 + cmd_line += " " + esc_cmd 63 + continue 64 + else: 65 + cmd_line = esc_cmd 66 + 67 + return cmd_line 68 + 46 69 class KernelDocDirective(Directive): 47 70 """Extract kernel-doc comments from the specified file""" 48 71 required_argument = 1 ··· 80 57 } 81 58 has_content = False 82 59 logger = logging.getLogger('kerneldoc') 60 + verbose = 0 83 61 84 62 def run(self): 85 63 env = self.state.document.settings.env ··· 88 64 89 65 filename = env.config.kerneldoc_srctree + '/' + self.arguments[0] 90 66 export_file_patterns = [] 67 + 68 + verbose = os.environ.get("V") 69 + if verbose: 70 + try: 71 + self.verbose = int(verbose) 72 + except ValueError: 73 + pass 91 74 92 75 # Tell sphinx of the dependency 93 76 env.note_dependency(os.path.abspath(filename)) ··· 134 103 cmd += ['-export-file', f] 135 104 136 105 cmd += [filename] 106 + 107 + if self.verbose >= 1: 108 + print(cmd_str(cmd)) 137 109 138 110 try: 139 111 self.logger.verbose("calling kernel-doc '%s'" % (" ".join(cmd)))