[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4fb2181c960e89774309a833f80209a1a3ab10d2.1754992972.git.mchehab+huawei@kernel.org>
Date: Tue, 12 Aug 2025 17:52:38 +0200
From: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
To: Linux Doc Mailing List <linux-doc@...r.kernel.org>
Cc: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>,
"Jonathan Corbet" <corbet@....net>,
"Mauro Carvalho Chehab" <mchehab+huawei@...nel.org>,
linux-kernel@...r.kernel.org
Subject: [PATCH v2 21/39] scripts: sphinx-pre-install: move package instructions to a new func
Currently, if Python < 3.7, package install will fail. That happens
with OpenSuse Leap and RHEL-based ver 8 distros.
OpenSuse allows installing Sphinx with Python 3.11, but RHEL-based
distros don't.
Prepare to recomend only venv on such cases. For now, just split
the recomendation on a new function that will check for a
paramtere to be called.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
---
scripts/sphinx-pre-install.py | 44 +++++++++++++++++++++--------------
1 file changed, 26 insertions(+), 18 deletions(-)
diff --git a/scripts/sphinx-pre-install.py b/scripts/sphinx-pre-install.py
index 2f6036eadc94..2360ca2ed21c 100755
--- a/scripts/sphinx-pre-install.py
+++ b/scripts/sphinx-pre-install.py
@@ -89,6 +89,9 @@ class SphinxDependencyChecker:
self.python_cmd = ""
self.activate_cmd = ""
+ # Some distros may not have a Sphinx shipped package compatible with
+ # our minimal requirements
+ self.package_supported = True
# Certain hints are meant to be shown only once
self.first_hint = True
@@ -969,6 +972,27 @@ class SphinxDependencyChecker:
return self.latest_avail_ver
+ def recommend_package(self):
+
+ print("\n2) As a package with:")
+
+ old_need = self.need
+ old_optional = self.optional
+ self.missing = {}
+ self.pdf = False
+ self.optional = 0
+ self.install = ""
+ old_verbose = self.verbose_warn_install
+ self.verbose_warn_install = 0
+
+ self.add_package("python-sphinx", 0)
+
+ self.check_distros()
+
+ self.need = old_need
+ self.optional = old_optional
+ self.verbose_warn_install = old_verbose
+
def recommend_sphinx_version(self, virtualenv_cmd):
# The logic here is complex, as it have to deal with different versions:
# - minimal supported version;
@@ -1053,24 +1077,8 @@ class SphinxDependencyChecker:
print(f"\tpip install -r {self.requirement_file}")
self.deactivate_help()
- print("\n2) As a package with:")
-
- old_need = self.need
- old_optional = self.optional
- self.missing = {}
- self.pdf = False
- self.optional = 0
- self.install = ""
- old_verbose = self.verbose_warn_install
- self.verbose_warn_install = 0
-
- self.add_package("python-sphinx", 0)
-
- self.check_distros()
-
- self.need = old_need
- self.optional = old_optional
- self.verbose_warn_install = old_verbose
+ if self.package_supported:
+ self.recommend_package()
print("\n" \
" Please note that Sphinx >= 3.0 will currently produce false-positive\n" \
--
2.50.1
Powered by blists - more mailing lists