From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Linux Doc Mailing List <linux-doc@vger.kernel.org>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
"Jonathan Corbet" <corbet@lwn.net>,
"Mauro Carvalho Chehab" <mchehab+huawei@kernel.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH v2 07/39] scripts: sphinx-pre-install: drop support for old virtualenv
Date: Tue, 12 Aug 2025 17:52:24 +0200 [thread overview]
Message-ID: <31afe394bcfd8f7e450263c1922d2c73b91d36d8.1754992972.git.mchehab+huawei@kernel.org> (raw)
In-Reply-To: <cover.1754992972.git.mchehab+huawei@kernel.org>
Up to Python 3.2, the virtual environment were created
via virtualenv binary.
As we dropped support for such old version, clean up the code.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
scripts/sphinx-pre-install.py | 69 +++++++++--------------------------
1 file changed, 18 insertions(+), 51 deletions(-)
diff --git a/scripts/sphinx-pre-install.py b/scripts/sphinx-pre-install.py
index b639acd455cc..0a73b1b33842 100755
--- a/scripts/sphinx-pre-install.py
+++ b/scripts/sphinx-pre-install.py
@@ -80,7 +80,6 @@ class SphinxDependencyChecker:
self.need_symlink = 0
self.need_sphinx = 0
self.need_pip = 0
- self.need_virtualenv = 0
self.rec_sphinx_upgrade = 0
self.verbose_warn_install = 1
@@ -919,12 +918,14 @@ class SphinxDependencyChecker:
else:
print("\nSphinx needs to be installed either:\n1) via pip/pypi with:\n")
- self.python_cmd = os.path.abspath(sys.argv[0])
-
- print(f"\t{virtualenv_cmd} {self.virtenv_dir}")
- print(f"\t. {self.virtenv_dir}/bin/activate")
- print(f"\tpip install -r {self.requirement_file}")
- self.deactivate_help()
+ if not virtualenv_cmd:
+ print(" Currently not possible.\n")
+ print(" Please upgrade Python to a newer version and run this script again")
+ else:
+ print(f"\t{virtualenv_cmd} {self.virtenv_dir}")
+ print(f"\t. {self.virtenv_dir}/bin/activate")
+ print(f"\tpip install -r {self.requirement_file}")
+ self.deactivate_help()
print("\n2) As a package with:")
@@ -953,6 +954,7 @@ class SphinxDependencyChecker:
def check_needs(self):
self.get_system_release()
+ self.python_cmd = sys.executable
# Check if Sphinx is already accessible from current environment
self.check_sphinx()
@@ -965,56 +967,21 @@ class SphinxDependencyChecker:
ver = ver_str(self.cur_version)
print(f"Sphinx version: {ver}\n")
- # FIXME: Check python command line, trying first python3
- self.python_cmd = self.which("python3")
- if not self.python_cmd:
- self.python_cmd = self.check_program("python", 0)
-
# Check the type of virtual env, depending on Python version
- if self.python_cmd:
- if self.virtualenv:
- try:
- result = self.run(
- [self.python_cmd, "--version"],
- capture_output=True,
- text=True,
- check=True,
- )
+ virtualenv_cmd = None
- output = result.stdout + result.stderr
-
- match = re.search(r"(\d+)\.(\d+)\.", output)
- if match:
- major = int(match.group(1))
- minor = int(match.group(2))
-
- if major < 3:
- sys.exit("Python 3 is required to build the kernel docs")
- if major == 3 and minor < 3:
- self.need_virtualenv = True
- else:
- sys.exit(f"Warning: couldn't identify {self.python_cmd} version!")
-
- except subprocess.CalledProcessError as e:
- sys.exit(f"Error checking Python version: {e}")
- else:
- self.add_package("python-sphinx", 0)
+ if sys.version_info < MIN_PYTHON_VERSION:
+ min_ver = ver_str(MIN_PYTHON_VERSION)
+ print(f"ERROR: at least python {min_ver} is required to build the kernel docs")
+ self.need_sphinx = 1
self.venv_ver = self.recommend_sphinx_upgrade()
- virtualenv_cmd = ""
-
if self.need_pip:
- # Set virtualenv command line, if python < 3.3
- # FIXME: can be removed as we're now with an upper min requirement
- # but then we need to check python version
- if self.need_virtualenv:
- virtualenv_cmd = self.which("virtualenv-3")
- if not virtualenv_cmd:
- virtualenv_cmd = self.which("virtualenv-3.5")
- if not virtualenv_cmd:
- self.check_program("virtualenv", 0)
- virtualenv_cmd = "virtualenv"
+ if sys.version_info < MIN_PYTHON_VERSION:
+ self.need_pip = False
+ print("Warning: python version is not supported.")
+
else:
virtualenv_cmd = f"{self.python_cmd} -m venv"
self.check_python_module("ensurepip", 0)
--
2.50.1
next prev parent reply other threads:[~2025-08-12 15:53 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-12 15:52 [PATCH v2 00/39] Translate sphinx-pre-install to Python Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 01/39] scripts: sphinx-pre-install: fix version check for Fedora Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 02/39] scripts: sphinx-pre-install: rename it to scripts/sphinx-pre-install.pl Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 03/39] scripts: sphinx-pre-install: Convert script to Python Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 04/39] scripts: sphinx-pre-install: Make it compatible with Python 3.6 Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 05/39] scripts: sphinx-pre-install: run on a supported version Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 06/39] scripts: sphinx-pre-install: drop obsolete routines Mauro Carvalho Chehab
2025-08-12 15:52 ` Mauro Carvalho Chehab [this message]
2025-08-12 15:52 ` [PATCH v2 08/39] scripts: sphinx-pre-install: Address issues with OpenSUSE Leap 15.x Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 09/39] scripts: sphinx-pre-install: fix opensuse Leap hint for PyYAML Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 10/39] scripts: sphinx-pre-install: fix support for gentoo Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 11/39] scripts: sphinx-pre-install: Address issues with OpenSUSE Tumbleweed Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 12/39] scripts: sphinx-pre-install: only show portage hints once Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 13/39] scripts: sphinx-pre-install: cleanup rhel support Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 14/39] scripts: sphinx-pre-install: output Python and docutils version Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 15/39] scripts: sphinx-pre-install: add a missing f-string marker Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 16/39] scripts: sphinx-pre-install: fix Leap support for rsvg-convert Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 17/39] scripts: sphinx-pre-install: fix rhel recomendations Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 18/39] scripts: sphinx-pre-install: remove Scientific Linux Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 19/39] scripts: sphinx-pre-install: improve Gentoo package deps logic Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 20/39] scripts: sphinx-pre-install: fix OpenMandriva support Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 21/39] scripts: sphinx-pre-install: move package instructions to a new func Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 22/39] scripts: sphinx-pre-install: adjust a warning message Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 23/39] scripts: sphinx-pre-install: better handle Python min version Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 24/39] scripts: sphinx-pre-install: convert is_optional to a class Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 25/39] scripts: sphinx-pre-install: better handle RHEL-based distros Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 26/39] scripts: sphinx-pre-install: move missing logic to a separate class Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 27/39] scripts: sphinx-pre-install: move ancillary checkers " Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 28/39] scripts: sphinx-pre-install: add more generic checkers on a class Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 29/39] scripts: sphinx-pre-install: move get_system_release() Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 30/39] scripts: sphinx-pre-install: add documentation for the ancillary classes Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 31/39] scripts: sphinx-pre-install: add docstring documentation Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 32/39] scripts: sphinx-pre-install: fix several codingstyle issues Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 33/39] scripts: sphinx-pre-install: rework install command logic Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 34/39] docs: Makefile: switch to the new scripts/sphinx-pre-install.py Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 35/39] scripts: sphinx-pre-install.pl: get rid of the old script Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 36/39] scripts: sphinx-pre-install: update mandatory system deps Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 37/39] scripts: sphinx-pre-install: add support for RHEL8-based distros Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 38/39] scripts: sphinx-pre-install: add a warning for Debian-based distros Mauro Carvalho Chehab
2025-08-12 15:52 ` [PATCH v2 39/39] scripts: sphinx-pre-install: some adjustments related to venv Mauro Carvalho Chehab
2025-08-13 16:23 ` [PATCH v2 00/39] Translate sphinx-pre-install to Python Jonathan Corbet
-- strict thread matches above, loose matches on Subject: below --
2025-07-09 13:51 Mauro Carvalho Chehab
2025-07-09 13:51 ` [PATCH v2 07/39] scripts: sphinx-pre-install: drop support for old virtualenv 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=31afe394bcfd8f7e450263c1922d2c73b91d36d8.1754992972.git.mchehab+huawei@kernel.org \
--to=mchehab+huawei@kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).