[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f27ae904076159916a01016263275fdafc301df6.1752067814.git.mchehab+huawei@kernel.org>
Date: Wed, 9 Jul 2025 15:51:47 +0200
From: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
To: Linux Doc Mailing List <linux-doc@...r.kernel.org>,
Jonathan Corbet <corbet@....net>
Cc: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>,
"Akira Yokosawa" <akiyks@...il.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
linux-kernel@...r.kernel.org
Subject: [PATCH v2 15/39] scripts: sphinx-pre-install: add a missing f-string marker
I forgot one f-string marker, with turned to be affecting 3
lines, because of cut-and-paste ;-)
Use the proper f-string marker to print Sphinx version at
the hint lines. Yet, we don't want to print as a tuple, so
call ver_str() for it.
Ideally, we would be placing it directly at the f-string, but
Python 3.6 f-string support was pretty much limited. Only
3.12 (PEP 701) makes it similar to Perl, allowing expressions
inside it. It sounds that function call itself was introduced
on 3.7.
As we explicitly want this one to run on 3.6, as latest Leap
comes with it, we can't use function calls on f-string.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
---
scripts/sphinx-pre-install.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/scripts/sphinx-pre-install.py b/scripts/sphinx-pre-install.py
index de5bcfd052b5..6a244105f7ef 100755
--- a/scripts/sphinx-pre-install.py
+++ b/scripts/sphinx-pre-install.py
@@ -914,12 +914,15 @@ class SphinxDependencyChecker:
if self.cur_version != (0, 0, 0) and self.cur_version >= RECOMMENDED_VERSION:
return
+ if self.latest_avail_ver:
+ latest_avail_ver = ver_str(self.latest_avail_ver)
+
if not self.need_sphinx:
# sphinx-build is present and its version is >= $min_version
# only recommend enabling a newer virtenv version if makes sense.
if self.latest_avail_ver and self.latest_avail_ver > self.cur_version:
- print("\nYou may also use the newer Sphinx version {self.latest_avail_ver} with:")
+ print(f"\nYou may also use the newer Sphinx version {latest_avail_ver} with:")
if f"{self.virtenv_prefix}" in os.getcwd():
print("\tdeactivate")
print(f"\t. {self.activate_cmd}")
@@ -940,7 +943,7 @@ class SphinxDependencyChecker:
# installed one via virtenv with a newer version.
# So, print commands to enable it
if self.latest_avail_ver > self.cur_version:
- print("\nYou may also use the Sphinx virtualenv version {self.latest_avail_ver} with:")
+ print(f"\nYou may also use the Sphinx virtualenv version {latest_avail_ver} with:")
if f"{self.virtenv_prefix}" in os.getcwd():
print("\tdeactivate")
print(f"\t. {self.activate_cmd}")
@@ -954,7 +957,7 @@ class SphinxDependencyChecker:
# Suggest newer versions if current ones are too old
if self.latest_avail_ver and self.latest_avail_ver >= self.min_version:
if self.latest_avail_ver >= RECOMMENDED_VERSION:
- print("\nNeed to activate Sphinx (version {self.latest_avail_ver}) on virtualenv with:")
+ print(f"\nNeed to activate Sphinx (version {latest_avail_ver}) on virtualenv with:")
print(f"\t. {self.activate_cmd}")
self.deactivate_help()
return
--
2.49.0
Powered by blists - more mailing lists