From nobody Tue Oct 7 08:52:32 2025 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 DA77E1E9915; Fri, 11 Jul 2025 07:27:16 +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=1752218837; cv=none; b=G+i7ysSf71PwSI5erj66NRA+pcA2r2rVrrptmrdH1z3p/eUgx2BhFPQVz8y9Gxl/ta7cNlbL9HUH3iG8UBXlAruAoUklQ+XeR2vpspei4Tn18jLWCy+5YsimxnlgsZlyD/+hnY3Ta9Znh7tDMYecYrXld0rNXDDXolgXTeF9r6Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752218837; c=relaxed/simple; bh=aeJ02hZTUwEfKqzaIBFSu41Svph78iymEyJtqAZNOhw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Mt8pLfI1iGKeD8W4inS4zC28CPVoVfH7D5KaTepPlwPS1rzbvv5es1uop44+iGTxeh0a9g5WArGwZ+egSQVNR+eSOsAtGRPtmyhH9ggv3FBLY833gviNnTIPc7WMWBm1QQGSK0F3+ioF9uiOQyD9GD5XsJSa3xz9G41aV3i2Zgo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FfnP/8HM; 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="FfnP/8HM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1255C4CEEF; Fri, 11 Jul 2025 07:27:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1752218836; bh=aeJ02hZTUwEfKqzaIBFSu41Svph78iymEyJtqAZNOhw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FfnP/8HMPBFj9BrzwdsN1ENsGmAyqIunJkx1fx99Hz5Rp0bYvPqmN64MHFKuaQhvF E4I9t9DyQao6yTwskYuHwA8oKvry/8zUc2S12njMjUzjLHks66g3GidFy+Wsw4/rHX o7e6UdNnmvudvH+E75CL8JvOcR9e6Q2LTbH9Jc0xS/s9CJg/O2hpbPtBqLsdyEvkPU oGIMr1Q0NMWekQ+t3IqjYivyGfpYChjxydI4HyyAY2J8J3fqA/l66m5O0+mvjVyOIJ LL9uw7sdZSnuOjGP6rUgGCwTSznxz9ZLYngCzif6lS2s9y1W+7oWpUVt6BR0EPc1mj tzglekjCbsACQ== Received: from mchehab by mail.kernel.org with local (Exim 4.98.2) (envelope-from ) id 1ua8A6-0000000FSSr-3OL1; Fri, 11 Jul 2025 09:27:14 +0200 From: Mauro Carvalho Chehab To: Linux Doc Mailing List , Jonathan Corbet Cc: Mauro Carvalho Chehab , "Akira Yokosawa" , "Mauro Carvalho Chehab" , linux-kernel@vger.kernel.org Subject: [PATCH 1/2] docs: kernel-doc: emit warnings for ancient versions of Python Date: Fri, 11 Jul 2025 09:27:08 +0200 Message-ID: <7d7fa3a3aa1fafa0cc9ea29c889de4c7d377dca6.1752218291.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.50.0 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" Kernel-doc requires at least version 3.6 to run, as it uses f-string. Yet, Kernel build currently calls kernel-doc with -none on some places. Better not to bail out when older versions are found. Versions of Python prior to 3.7 do not guarantee to remember the insertion order of dicts; since kernel-doc depends on that guarantee, running with such older versions could result in output with reordered sections. Check Python version when called via command line. Signed-off-by: Mauro Carvalho Chehab --- scripts/kernel-doc.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/kernel-doc.py b/scripts/kernel-doc.py index 12ae66f40bd7..fc3d46ef519f 100755 --- a/scripts/kernel-doc.py +++ b/scripts/kernel-doc.py @@ -271,6 +271,16 @@ def main(): =20 logger.addHandler(handler) =20 + python_ver =3D sys.version_info[:2] + if python_ver < (3,6): + logger.warning("Python 3.6 or later is required by kernel-doc") + + # Return 0 here to avoid breaking compilation + sys.exit(0) + + if python_ver < (3,7): + logger.warning("Python 3.7 or later is required for correct result= s") + if args.man: out_style =3D ManFormat(modulename=3Dargs.modulename) elif args.none: --=20 2.50.0 From nobody Tue Oct 7 08:52:32 2025 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 D66AE1E9B08; Fri, 11 Jul 2025 07:27:16 +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=1752218836; cv=none; b=gx3S7gMgnaXUwrXPNYU1Fx65NIHmxOPfed0R9jkZ6bXJYxJe34WcYii9Mt5A9Td0kXb8J8r7w+RcvO8VTT6DR+eeAei6eG6tv030/bAyXldIB0WUW4LsdS2JZgnzVKBsJhzxSXbf2LTYwLOKndCLGJdaRvjvv9Cduz3rucAzZvA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752218836; c=relaxed/simple; bh=nBkQTkDhZsnzFFW82qYBM0kzGOHtVEnCtN29bE/ppyI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DmbM9JGDHfSG393C3nBPJ6tXsgv7cisbfQmgFbd6/wjDGfaj2ayv10twtly/OcBrgvPMm68OGLYQY7Cl2O4FRX4o2LsobUoh0iZIZZnG8llslP1CfDq6epdBc3g/osaxVPvI3z0HDYoARj1Relo6AcnlKFv+KF1HXIS8I6KWP3s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=l6wWHyBL; 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="l6wWHyBL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE67BC4CEED; Fri, 11 Jul 2025 07:27:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1752218836; bh=nBkQTkDhZsnzFFW82qYBM0kzGOHtVEnCtN29bE/ppyI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l6wWHyBLm879opsQjQhj5oTUoT5nOVp0YySKdjwu4XfL4JshB7+BRDo3+4xUPxmlX OIBGhrT/MCXfhddusElEhYm+1onc0J03TPNenBMTraHAgPtfCnVqSHVbgJlgTV3BI3 r6LUnP3Ev0r2iZUTd4XkAMcLBZRC9zjAxt1VdFhrPjUsrzjxgY8gWWnT1NaqeJlzsY /t2/hZv8GNZ2HAXiuwsWccQ8KZplxMkONlp4tqXsC1Odk44/++8x7x3MrJ5cgoZ4at tjXkDwZ5xwCXzwX1PQNtT/YusCtOHegk2oAZhiKu2GSgUpxVObxoSrRqWChQlccAQe F9PUVF4hhnVSA== Received: from mchehab by mail.kernel.org with local (Exim 4.98.2) (envelope-from ) id 1ua8A6-0000000FSSv-3VEV; Fri, 11 Jul 2025 09:27:14 +0200 From: Mauro Carvalho Chehab To: Linux Doc Mailing List , Jonathan Corbet Cc: Mauro Carvalho Chehab , "Akira Yokosawa" , "Matthew Wilcox (Oracle)" , "Mauro Carvalho Chehab" , linux-kernel@vger.kernel.org Subject: [PATCH 2/2] scripts: kdoc: make it backward-compatible with Python 3.7 Date: Fri, 11 Jul 2025 09:27:09 +0200 Message-ID: X-Mailer: git-send-email 2.50.0 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" There was a change at kdoc that ended breaking compatibility with Python 3.7: str.removesuffix() was introduced on version 3.9. Restore backward compatibility. Reported-by: Akira Yokosawa Closes: https://lore.kernel.org/linux-doc/57be9f77-9a94-4cde-aacb-184cae111= 506@gmail.com/ Fixes: 27ad33b6b349 ("kernel-doc: Fix symbol matching for dropped suffixes") Signed-off-by: Mauro Carvalho Chehab --- scripts/lib/kdoc/kdoc_parser.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/lib/kdoc/kdoc_parser.py b/scripts/lib/kdoc/kdoc_parser= .py index 831f061f61b8..6273141033a8 100644 --- a/scripts/lib/kdoc/kdoc_parser.py +++ b/scripts/lib/kdoc/kdoc_parser.py @@ -1214,7 +1214,9 @@ class KernelDoc: # Found an export, trim out any special suffixes # for suffix in suffixes: - symbol =3D symbol.removesuffix(suffix) + # Be backward compatible with Python < 3.9 + if symbol.endswith(suffix): + symbol =3D symbol[:-len(suffix)] function_set.add(symbol) return True =20 --=20 2.50.0