From nobody Mon Feb 9 01:17:04 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B961624A059; Mon, 24 Feb 2025 09:09:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740388143; cv=none; b=MYtJQunr1t7dEeIepsG21znRQLbo7T98Fu3E0vX6snpyXcy0lzKb9Py9Hnz9vz6gfzxIPRpJpk8QsFnrlIp3c4tnJOJ6xxGeOJ6YQDdUKtqbbhz7mScqShSxy4MpsBefAXJ1avIxSU89wo57Wc8RYyjunKbVwmio4DsvLFUufPI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740388143; c=relaxed/simple; bh=visFeBdmwWEXGD09mdOdO30j7sy6oK5qUh63NaeMIjk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qXVVLS40twCGnjFj1qYnSQam2AiT7OxHO4gUNp7CFksnw+jjSLkoUyRBTPZ/Yw5qfhhF3IXashddFRzRg612XvOBTOHgYYJP28Gbm5ga26NHEzCg8doa+D4PIVWcN00QsZnQiIM3+re0kpxI9Yq/aj9H5lmzHihtB+1mVNQPrMs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UYNoedzr; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UYNoedzr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CAF1C4CEF0; Mon, 24 Feb 2025 09:09:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740388143; bh=visFeBdmwWEXGD09mdOdO30j7sy6oK5qUh63NaeMIjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UYNoedzrk4yrV8BKWtMh6MleKLHnYVN+RvNQjy643BNEae3Jxrr6d6ScSfdmtY/oR Lp6qEOtUAI9Hi87Ms0G4YI8Tn9K82cUaQv1T1GzZoUC641o31tT1A7FQ+rR6lil4na BQ8CQdC8QzF9YshTHKm4ocSLfDgoPzJ1ina35cn8a6xa2qqHBlLWi1dlpOSGtwHpuW 02AnxSFYndaazymwY5Jjn3XJEB/NNhUY+II5bi0PsIc/hMfh95gaUxWpE8aLzh2UFO iEK9sa3aFx783TXoczEHSr+fl6Kla2K3/E/AqiE4NDfU3zXDr9IRrJkV9kSBAlM1RH M9/QTfHeSCHKg== Received: from mchehab by mail.kernel.org with local (Exim 4.98) (envelope-from ) id 1tmUST-00000003p52-1yTx; Mon, 24 Feb 2025 10:09:01 +0100 From: Mauro Carvalho Chehab To: Linux Doc Mailing List , Jonathan Corbet Cc: Mauro Carvalho Chehab , "Mauro Carvalho Chehab" , Kees Cook , linux-kernel@vger.kernel.org Subject: [PATCH v2 25/39] docs: sphinx: kerneldoc: verbose kernel-doc command if V=1 Date: Mon, 24 Feb 2025 10:08:31 +0100 Message-ID: <299b7351d1f395031c79521cf3503e47baa1d4a1.1740387599.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab Content-Type: text/plain; charset="utf-8" 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 --- Documentation/sphinx/kerneldoc.py | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/Documentation/sphinx/kerneldoc.py b/Documentation/sphinx/kerne= ldoc.py index 39ddae6ae7dd..d206eb2be10a 100644 --- a/Documentation/sphinx/kerneldoc.py +++ b/Documentation/sphinx/kerneldoc.py @@ -43,6 +43,29 @@ from sphinx.util import logging =20 __version__ =3D '1.0' =20 +def cmd_str(cmd): + """ + Helper function to output a command line that can be used to produce + the same records via command line. Helpful to debug troubles at the + script. + """ + + cmd_line =3D "" + + for w in cmd: + if w =3D=3D "" or " " in w: + esc_cmd =3D "'" + w + "'" + else: + esc_cmd =3D w + + if cmd_line: + cmd_line +=3D " " + esc_cmd + continue + else: + cmd_line =3D esc_cmd + + return cmd_line + class KernelDocDirective(Directive): """Extract kernel-doc comments from the specified file""" required_argument =3D 1 @@ -57,6 +80,7 @@ class KernelDocDirective(Directive): } has_content =3D False logger =3D logging.getLogger('kerneldoc') + verbose =3D 0 =20 def run(self): env =3D self.state.document.settings.env @@ -65,6 +89,13 @@ class KernelDocDirective(Directive): filename =3D env.config.kerneldoc_srctree + '/' + self.arguments[0] export_file_patterns =3D [] =20 + verbose =3D os.environ.get("V") + if verbose: + try: + self.verbose =3D int(verbose) + except ValueError: + pass + # Tell sphinx of the dependency env.note_dependency(os.path.abspath(filename)) =20 @@ -104,6 +135,9 @@ class KernelDocDirective(Directive): =20 cmd +=3D [filename] =20 + if self.verbose >=3D 1: + print(cmd_str(cmd)) + try: self.logger.verbose("calling kernel-doc '%s'" % (" ".join(cmd)= )) =20 --=20 2.48.1