mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Linux Doc Mailing List <linux-doc@vger.kernel.org>,
	Jonathan Corbet <corbet@lwn.net>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
	"Akira Yokosawa" <akiyks@gmail.com>,
	"Mauro Carvalho Chehab" <mchehab+huawei@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: [PATCH v3 06/15] scripts: test_doc_build.py: better adjust to python version
Date: Sun, 22 Jun 2025 08:02:35 +0200	[thread overview]
Message-ID: <32cb41c543293bbbab5fcb15f8a0aefac040e3a9.1750571906.git.mchehab+huawei@kernel.org> (raw)
In-Reply-To: <cover.1750571906.git.mchehab+huawei@kernel.org>

Very old versions of Sphinx require older versions of python.
The original script assumes that a python3.9 exec exists,
but this may not be the case.

Relax python requirements.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
 scripts/test_doc_build.py | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/scripts/test_doc_build.py b/scripts/test_doc_build.py
index 5b9eb2c0bf01..129c2862065c 100755
--- a/scripts/test_doc_build.py
+++ b/scripts/test_doc_build.py
@@ -12,15 +12,28 @@ and optionally test the build.
 import argparse
 import asyncio
 import os.path
+import shutil
 import sys
 import time
 import subprocess
 
-# Minimal python version supported by the building system
-MINIMAL_PYTHON_VERSION = "python3.9"
+# Minimal python version supported by the building system.
 
-# Starting from 8.0.2, Python 3.9 becomes too old
-PYTHON_VER_CHANGES = {(8, 0, 2): "python3"}
+PYTHON = os.path.basename(sys.executable)
+
+min_python_bin = None
+
+for i in range(9, 13):
+    p = f"python3.{i}"
+    if shutil.which(p):
+        min_python_bin = p
+        break
+
+if not min_python_bin:
+    min_python_bin = PYTHON
+
+# Starting from 8.0, Python 3.9 is not supported anymore.
+PYTHON_VER_CHANGES = {(8, 0, 2): PYTHON}
 
 # Sphinx versions to be installed and their incremental requirements
 SPHINX_REQUIREMENTS = {
@@ -290,7 +303,7 @@ class SphinxVenv:
                 args.verbose = True
 
         cur_requirements = {}
-        python_bin = MINIMAL_PYTHON_VERSION
+        python_bin = min_python_bin
 
         for cur_ver, new_reqs in SPHINX_REQUIREMENTS.items():
             cur_requirements.update(new_reqs)
-- 
2.49.0


  parent reply	other threads:[~2025-06-22  6:02 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-22  6:02 [PATCH v3 00/15] Some improvements and fixes for the doc build system Mauro Carvalho Chehab
2025-06-22  6:02 ` [PATCH v3 01/15] docs: conf.py: properly handle include and exclude patterns Mauro Carvalho Chehab
2025-06-22  6:02 ` [PATCH v3 02/15] docs: Makefile: disable check rules on make cleandocs Mauro Carvalho Chehab
2025-06-22  6:02 ` [PATCH v3 03/15] scripts: scripts/test_doc_build.py: add script to test doc build Mauro Carvalho Chehab
2025-06-22  6:02 ` [PATCH v3 04/15] scripts: test_doc_build.py: make capture assynchronous Mauro Carvalho Chehab
2025-06-22  6:02 ` [PATCH v3 05/15] scripts: test_doc_build.py: better control its output Mauro Carvalho Chehab
2025-06-22  6:02 ` Mauro Carvalho Chehab [this message]
2025-06-22  6:02 ` [PATCH v3 07/15] scripts: test_doc_build.py: improve dependency list Mauro Carvalho Chehab
2025-06-22  6:02 ` [PATCH v3 08/15] scripts: test_doc_build.py: improve cmd.log logic Mauro Carvalho Chehab
2025-06-22  6:02 ` [PATCH v3 09/15] scripts: test_doc_build.py: make the script smarter Mauro Carvalho Chehab
2025-06-22  6:02 ` [PATCH v3 10/15] scripts: sphinx-pre-install: properly handle SPHINXBUILD Mauro Carvalho Chehab
2025-06-22  6:02 ` [PATCH v3 11/15] scripts: sphinx-pre-install: fix release detection for Fedora Mauro Carvalho Chehab
2025-06-22  6:02 ` [PATCH v3 12/15] scripts: test_doc_build.py: regroup and rename arguments Mauro Carvalho Chehab
2025-06-22  6:02 ` [PATCH v3 13/15] docs: sphinx: add a file with the requirements for lowest version Mauro Carvalho Chehab
2025-06-22  6:02 ` [PATCH v3 14/15] docs: conf.py: several coding style fixes Mauro Carvalho Chehab
2025-06-22 20:55   ` Jonathan Corbet
2025-06-22 21:41     ` Mauro Carvalho Chehab
2025-06-22  6:02 ` [PATCH v3 15/15] docs: conf.py: Check Sphinx and docutils version Mauro Carvalho Chehab
2025-06-22 11:19   ` Akira Yokosawa
2025-06-22 17:53     ` Mauro Carvalho Chehab
2025-06-22 18:06     ` Mauro Carvalho Chehab
2025-06-22 20:58     ` Jonathan Corbet
2025-06-22 21:50       ` Mauro Carvalho Chehab
2025-06-25 18:37         ` Jonathan Corbet
2025-06-25 20:18           ` Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=32cb41c543293bbbab5fcb15f8a0aefac040e3a9.1750571906.git.mchehab+huawei@kernel.org \
    --to=mchehab+huawei@kernel.org \
    --cc=akiyks@gmail.com \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®