From nobody Fri Oct 3 07:39:30 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 EBC372C158D; Wed, 3 Sep 2025 16:24:30 +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=1756916671; cv=none; b=HnICFFQoJ3u9GPNl5OiZePFOBMXHAoRWaiLmTuy6WDTuh2rtzeUcTn+S/WaXm0AfF6laPqF+KNu3OP7D8tW0kF2Xduydi6aTQeBe49TBWgu+CnkOHKXtoP6GzHi82DEPNR1yti5zdNwYWd394vmLwVEwglAp9O8Aw9AVdxYFJWA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756916671; c=relaxed/simple; bh=/dLIDswzK4KrvEpdBfQvdI/IqyHPjqk3TcTvIyNvmfo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=taTIfuSNZgvZTJTCfdUZ3FYh3fqJ+yAOvyiH/H6dEdya6bN4vDFRj4MouJYJXBEJyeMiU/3bJOe+riK9Ps3k6zsvIAzSfz8nbUSXSOHdRI5AaIphBmn6QmClTe6tlHIcvjBRnqjhF1kpY6iOrXCydEa6YADa310ynzvurtM4iVE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JaZ9P6Eb; 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="JaZ9P6Eb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FB77C4CEE7; Wed, 3 Sep 2025 16:24:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1756916670; bh=/dLIDswzK4KrvEpdBfQvdI/IqyHPjqk3TcTvIyNvmfo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JaZ9P6Ebmy/gzRUpaykcZlZlqonMddP6lxt0wW0eatVGo06HIXx+ITUxXJCFr2I5V IQiJtyVnUVPbDz5SbIPGl0uR6GN5ITrWf1L8Ic7gb5F7Y0/tTw1r+KKGRhZSTund1x P1oGupNe83xrhNSwg0i7IN1VYmXHCQ4+fTQSRFC0LvCPHNQWMH9HoWSuOgo/YzLNw7 Bnj+OBhlPS/jUwXlV3rchrcn1cnBam7+Oeft9WH83T7dNI+nx8IIDHlqPoH3WJaYby nH7xqyizLY1pCE+mhAhGBa+pwj5t3HJLAmA02870ZO6ZaGyvPKyUofl46xAjJQZYrV Fr3ebH9KbIpeA== Received: from mchehab by mail.kernel.org with local (Exim 4.98.2) (envelope-from ) id 1utqHc-00000007Vom-3Wa9; Wed, 03 Sep 2025 18:24:28 +0200 From: Mauro Carvalho Chehab To: Jonathan Corbet , Linux Doc Mailing List Cc: Mauro Carvalho Chehab , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org Subject: [PATCH v2 1/3] tools/docs: python_version.py: drop a debug print Date: Wed, 3 Sep 2025 18:24:14 +0200 Message-ID: <623f783ca31fa33e71d700f1c5c659f7171acb51.1756916565.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: References: Content-Type: text/plain; charset="utf-8" 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 The version print at the lib was added for debugging purposes. Get rid of it. Signed-off-by: Mauro Carvalho Chehab --- tools/docs/lib/python_version.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/docs/lib/python_version.py b/tools/docs/lib/python_versi= on.py index 0519d524e547..660bfe7d23fa 100644 --- a/tools/docs/lib/python_version.py +++ b/tools/docs/lib/python_version.py @@ -109,8 +109,6 @@ class PythonVersion: cur_ver =3D sys.version_info[:3] if cur_ver >=3D min_version: ver =3D PythonVersion.ver_str(cur_ver) - print(f"Python version: {ver}") - return =20 python_ver =3D PythonVersion.ver_str(cur_ver) --=20 2.51.0 From nobody Fri Oct 3 07:39:30 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 EBD2C2D0636; Wed, 3 Sep 2025 16:24:30 +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=1756916671; cv=none; b=U6KPZAoJda+E8yKtTkMkce46psbJnFPy/KdPu2Hm3GMTQeGT26XkFODT82RPsMpkeoEGrsqMvLGptf35uiMNZpAYhRfs86sU1PqPSHLX5u2ZxfN/vHvaDpq4/symPUFuaXy0PHdc+BoFQDE3HuQZ0qg04ypXapyQ6Fzhl7ieR5o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756916671; c=relaxed/simple; bh=GdJwj3d3TAyo2Nn7d6rWe+07TNA7IyqQabnELNUF9QU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=qA2YpBojyK99nj5r3ETqyFaT2KoBbATQlxc18F8uVv/XLYR5J2t48UUXTEh3BDbofGitHJm5OpaFbBvR6V/8syDF2qXJkJln+K0wxI8pZ/la8UqJp00JWqM5VGnX+vRbE34UQKpu+g6hJh6izo6ILWen0FTbYThuovV83Bzi1wg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=OQs/gSS+; 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="OQs/gSS+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 940E8C4AF09; Wed, 3 Sep 2025 16:24:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1756916670; bh=GdJwj3d3TAyo2Nn7d6rWe+07TNA7IyqQabnELNUF9QU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OQs/gSS+7aITu9Cj48BCSgLcGOIt8jUSLQyKoxtCqMVlsmQcqsomIA4iJ4Gi8G1MD fcjuzy5hyaL+l5fBIzwyp5xalRuvw/vOTgGF8dMnu3qq30CUvh0KmekPE/n3I2Iyvz Fc+BBWkWgyNJyjWNCpoIxMwEk5PATmir7Zm6RAQYxFoS0YcYpLg0H/ri31Z1myFW21 GatD11+YZ52rN+pxL087d7qeSCVMWSNnpWKc9OfcR+XTq0Q4reCnJhjhgtda8CKisL P4psGia7LPbVYeHvMSoH2XAqiVr/WS9sY5Tx3slFVRoCpnEwd24UfsMZsjxd72iy9i HYmd8qaV4SUBg== Received: from mchehab by mail.kernel.org with local (Exim 4.98.2) (envelope-from ) id 1utqHc-00000007Vor-3dKE; Wed, 03 Sep 2025 18:24:28 +0200 From: Mauro Carvalho Chehab To: Jonathan Corbet , Linux Doc Mailing List Cc: Mauro Carvalho Chehab , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org Subject: [PATCH v2 2/3] tools/docs: python_version: allow check for alternatives and bail out Date: Wed, 3 Sep 2025 18:24:15 +0200 Message-ID: <6c2155e62b71e5e10fd4b17ecc33fb1187f7dca6.1756916565.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: References: Content-Type: text/plain; charset="utf-8" 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 The caller script may not want an automatic execution of the new version. Add two parameters to allow showing alternatives and to bail out if version is incompatible. Signed-off-by: Mauro Carvalho Chehab --- tools/docs/lib/python_version.py | 43 ++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/tools/docs/lib/python_version.py b/tools/docs/lib/python_versi= on.py index 660bfe7d23fa..a9fda2470a26 100644 --- a/tools/docs/lib/python_version.py +++ b/tools/docs/lib/python_version.py @@ -85,10 +85,12 @@ class PythonVersion: may need to update it one day, hopefully on a distant future. """ patterns =3D [ - "python3.[0-9]", "python3.[0-9][0-9]", + "python3.[0-9]", ] =20 + python_cmd =3D [] + # Seek for a python binary newer than min_version for path in os.getenv("PATH", "").split(":"): for pattern in patterns: @@ -96,12 +98,13 @@ class PythonVersion: if os.path.isfile(cmd) and os.access(cmd, os.X_OK): version =3D PythonVersion.get_python_version(cmd) if version >=3D min_version: - return cmd + python_cmd.append((version, cmd)) =20 - return None + return sorted(python_cmd, reverse=3DTrue) =20 @staticmethod - def check_python(min_version): + def check_python(min_version, show_alternatives=3DFalse, bail_out=3DFa= lse, + success_on_error=3DFalse): """ Check if the current python binary satisfies our minimal requireme= nt for Sphinx build. If not, re-run with a newer version if found. @@ -113,18 +116,42 @@ class PythonVersion: =20 python_ver =3D PythonVersion.ver_str(cur_ver) =20 - new_python_cmd =3D PythonVersion.find_python(min_version) - if not new_python_cmd: + available_versions =3D PythonVersion.find_python(min_version) + if not available_versions: print(f"ERROR: Python version {python_ver} is not spported any= more\n") print(" Can't find a new version. This script may fail") return =20 - # Restart script using the newer version script_path =3D os.path.abspath(sys.argv[0]) - args =3D [new_python_cmd, script_path] + sys.argv[1:] + + # Check possible alternatives + if available_versions: + new_python_cmd =3D available_versions[0][1] + else: + new_python_cmd =3D None + + if show_alternatives: + print("You could run, instead:") + for _, cmd in available_versions: + args =3D [cmd, script_path] + sys.argv[1:] + + cmd_str =3D " ".join(args) + print(f" {cmd_str}") + print() + + if bail_out: + msg =3D f"Python {python_ver} not supported. Bailing out" + if success_on_error: + print(msg, file=3Dsys.stderr) + sys.exit(0) + else: + sys.exit(msg) =20 print(f"Python {python_ver} not supported. Changing to {new_python= _cmd}") =20 + # Restart script using the newer version + args =3D [new_python_cmd, script_path] + sys.argv[1:] + try: os.execv(new_python_cmd, args) except OSError as e: --=20 2.51.0 From nobody Fri Oct 3 07:39:30 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 25C842D63E4; Wed, 3 Sep 2025 16:24:30 +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=1756916671; cv=none; b=ivGlkiadMQ4dm7Bkrhn4+fcRDi1EqK1tOMjnCsawNygHDsNYjhTBpiDK/1+fNKbE2rmi2EsJ9yxNh2cIkvdgDIszYZXCrARfRFXEzfnu0PuOPrHRdK+F3Ee5ZmNon3oqrZoxTohtfTE50zMvMWasCHXipw6+EWLUzf7Yvg03pLs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756916671; c=relaxed/simple; bh=DL6QTWpxjep8S77vkYK54cGY5aTugS5u3x3ExCSFzJc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=oyDjURu+ff3TvgbPLd7zbLEl949gA7smaqHwLVugvg9liQJ+m08ka3v5bahe2K8Nw4xfvowxCCbHfZRaHhgp9WPDfhfZc8S7pN8odX+lUhWBLkh+YNUvqvgZBkyb3Cu5Gd4xbIR2LKljyezWEPo1WDZdvvgJtdir/7KtojjaUas= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ChG+Pq3q; 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="ChG+Pq3q" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9EEA7C4CEF7; Wed, 3 Sep 2025 16:24:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1756916670; bh=DL6QTWpxjep8S77vkYK54cGY5aTugS5u3x3ExCSFzJc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ChG+Pq3qDcRC+nd4R6whFyaNia1iwrqnCqXksGoRITxD03ICyUn4RQpLKr7UHAkut HRog8JvEQ45l2VlKsVFoI9LC9sKQSL/HNK9SfFWeQoZbprCCTmfP84yQtFC9k30Lq4 FoyU9CFEMGuHrjuHQ6UfINLNSNJ5hGot05u8Wf7hV6fkggnT0MF4KZvE7f/xR1BA7f asBYUj9eqs+WUq3QbfehrVWmUJ41gwf2LPp6p4eO7X8tL1RXU3fyOXAOhQd9+js6jg 0yrCfVrD2RQLJCWa8Uhlrm9cyFCxj9zfO9OqYLzWH5bOnfUnYdfR45K2Fijj94GSlC DpZMs8XmcbIfg== Received: from mchehab by mail.kernel.org with local (Exim 4.98.2) (envelope-from ) id 1utqHc-00000007Vov-3kcx; Wed, 03 Sep 2025 18:24:28 +0200 From: Mauro Carvalho Chehab To: Jonathan Corbet , Linux Doc Mailing List Cc: Mauro Carvalho Chehab , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Alex Gaynor , Alice Ryhl , Andreas Hindborg , Benno Lossin , Boqun Feng , Danilo Krummrich , Gary Guo , Mauro Carvalho Chehab , Miguel Ojeda , Trevor Gross , linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org Subject: [PATCH v2 3/3] tools/docs: sphinx-* break documentation bulds on openSUSE Date: Wed, 3 Sep 2025 18:24:16 +0200 Message-ID: <29135db8c8094006f256e1fa0b64663c735737e7.1756916565.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: References: Content-Type: text/plain; charset="utf-8" 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 Before this patch, building htmldocs on opensuseLEAP works fine: # make htmldocs Available Python versions: /usr/bin/python3.11 Python 3.6.15 not supported. Changing to /usr/bin/python3.11 Python 3.6.15 not supported. Changing to /usr/bin/python3.11 Using alabaster theme Using Python kernel-doc ... As the logic detects that Python 3.6 is too old and recommends intalling python311-Sphinx. If installed, documentation builds work like a charm. Yet, some develpers complained that running python3.11 instead of python3 should not happen. So, let's break the build to make them happier: $ make htmldocs Python 3.6.15 not supported. Bailing out You could run, instead: /usr/bin/python3.11 /root/tools/docs/sphinx-build-wrapper htmldocs --= sphinxdirs=3D. --conf=3Dconf.py --theme=3D --css=3D --paper=3D Python 3.6.15 not supported. Bailing out make[2]: *** [Documentation/Makefile:75: htmldocs] Error 1 make[1]: *** [/root/Makefile:1806: htmldocs] Error 2 make: *** [Makefile:248: __sub-make] Error 2 It should be noticed that: 1. after this change, sphinx-pre-install needs to be called by hand: $ /usr/bin/python3.11 tools/docs/sphinx-pre-install Detected OS: openSUSE Leap 15.6. Sphinx version: 7.2.6 All optional dependencies are met. Needed package dependencies are met. 2. sphinx-build-wrapper will auto-detect python3.11 and suggest a way to build the docs using the parameters passed via make variables. In this specific example: /usr/bin/python3.11 /root/tools/docs/sphinx-build-wrapper htmldocs --sph= inxdirs=3D. --conf=3Dconf.py --theme=3D --css=3D --paper=3D 3. As this needs to be executed outside docs Makefile, it won't run the validation check scripts nor build Rust documentation if enabled, as the extra scripts are part of the docs Makefile. Signed-off-by: Mauro Carvalho Chehab --- tools/docs/sphinx-build-wrapper | 3 ++- tools/docs/sphinx-pre-install | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/docs/sphinx-build-wrapper b/tools/docs/sphinx-build-wrap= per index 932b1b675274..48e6e0a76aeb 100755 --- a/tools/docs/sphinx-build-wrapper +++ b/tools/docs/sphinx-build-wrapper @@ -719,7 +719,8 @@ def main(): =20 args =3D parser.parse_args() =20 - PythonVersion.check_python(MIN_PYTHON_VERSION) + PythonVersion.check_python(MIN_PYTHON_VERSION, show_alternatives=3DTru= e, + bail_out=3DTrue) =20 builder =3D SphinxBuilder(venv=3Dargs.venv, verbose=3Dargs.verbose, n_jobs=3Dargs.jobs, interactive=3Dargs.interac= tive) diff --git a/tools/docs/sphinx-pre-install b/tools/docs/sphinx-pre-install index 663d4e2a3f57..698989584b6a 100755 --- a/tools/docs/sphinx-pre-install +++ b/tools/docs/sphinx-pre-install @@ -1531,7 +1531,8 @@ def main(): =20 checker =3D SphinxDependencyChecker(args) =20 - PythonVersion.check_python(MIN_PYTHON_VERSION) + PythonVersion.check_python(MIN_PYTHON_VERSION, + bail_out=3DTrue, success_on_error=3DTrue) checker.check_needs() =20 # Call main if not used as module --=20 2.51.0