All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@kernel.org>
To: Linux Doc Mailing List <linux-doc@vger.kernel.org>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Mauro Carvalho Chehab" <mchehab+huawei@kernel.org>,
	ksummit-discuss@lists.linuxfoundation.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v2 1/5] scripts: sphinx-pre-install: fix venv version check logic
Date: Sat,  2 Jul 2022 11:11:25 +0100	[thread overview]
Message-ID: <afe01b7863fd655986d84ace8948f3d7aede796d.1656756450.git.mchehab@kernel.org> (raw)
In-Reply-To: <cover.1656756450.git.mchehab@kernel.org>

The logic which checks if the venv version is good enough
but was not activated is broken: it is checking against
the wrong val, making it to recommend to re-create a venv
every time. Fix it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH v2 0/5] at: https://lore.kernel.org/all/cover.1656756450.git.mchehab@kernel.org/

 scripts/sphinx-pre-install | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install
index f126ecbb0494..ae8c49734899 100755
--- a/scripts/sphinx-pre-install
+++ b/scripts/sphinx-pre-install
@@ -741,7 +741,7 @@ sub recommend_sphinx_upgrade()
 
 	# Get the highest version from sphinx_*/bin/sphinx-build and the
 	# corresponding command to activate the venv/virtenv
-	$activate_cmd = get_virtenv();
+	($activate_cmd, $venv_ver) = get_virtenv();
 
 	# Store the highest version from Sphinx existing virtualenvs
 	if (($activate_cmd ne "") && ($venv_ver gt $cur_version)) {
@@ -759,10 +759,14 @@ sub recommend_sphinx_upgrade()
 	# Either there are already a virtual env or a new one should be created
 	$need_pip = 1;
 
+	return if (!$latest_avail_ver);
+
 	# Return if the reason is due to an upgrade or not
 	if ($latest_avail_ver lt $rec_version) {
 		$rec_sphinx_upgrade = 1;
 	}
+
+	return $latest_avail_ver;
 }
 
 #
@@ -820,7 +824,7 @@ sub recommend_sphinx_version($)
 	}
 
 	# Suggest newer versions if current ones are too old
-	if ($latest_avail_ver && $cur_version ge $min_version) {
+	if ($latest_avail_ver && $latest_avail_ver ge $min_version) {
 		# If there's a good enough version, ask the user to enable it
 		if ($latest_avail_ver ge $rec_version) {
 			printf "\nNeed to activate Sphinx (version $latest_avail_ver) on virtualenv with:\n";
@@ -897,7 +901,7 @@ sub check_needs()
 		}
 	}
 
-	recommend_sphinx_upgrade();
+	my $venv_ver = recommend_sphinx_upgrade();
 
 	my $virtualenv_cmd;
 
-- 
2.36.1


  reply	other threads:[~2022-07-02 10:11 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-17 20:57 [TECH TOPIC] What kernel documentation could be Jonathan Corbet
2022-06-17 20:57 ` [Ksummit-discuss] " Jonathan Corbet
2022-06-17 21:48 ` Laurent Pinchart
2022-06-17 21:48   ` Laurent Pinchart
2022-06-27 15:18   ` Jonathan Corbet
2022-06-18  8:24 ` Mauro Carvalho Chehab
2022-06-18  8:24   ` Mauro Carvalho Chehab
2022-06-18 11:03   ` Miguel Ojeda
2022-06-18 11:16     ` Mauro Carvalho Chehab
2022-06-18 11:16       ` Mauro Carvalho Chehab
2022-06-18 14:37       ` Miguel Ojeda
2022-06-23  9:18   ` Jani Nikula
2022-06-23  9:57     ` Mauro Carvalho Chehab
2022-06-23 10:30       ` Jani Nikula
2022-06-23 13:40       ` Jonathan Corbet
2022-06-24  7:33         ` Mauro Carvalho Chehab
2022-06-24 16:37           ` Markus Heiser
2022-06-27 15:27             ` Jonathan Corbet
2022-06-27 15:31               ` Christoph Hellwig
2022-06-28  7:43               ` Mauro Carvalho Chehab
2022-06-28  7:57                 ` Geert Uytterhoeven
2022-06-28 11:01                   ` Mauro Carvalho Chehab
2022-07-02 12:43                     ` Stephen Rothwell
2022-06-24 22:57           ` Jonathan Corbet
2022-06-25  9:10             ` Mauro Carvalho Chehab
2022-06-25 14:00               ` Jonathan Corbet
2022-06-25 18:11                 ` Linus Torvalds
2022-06-26  7:55                   ` Mauro Carvalho Chehab
2022-06-26  9:26                     ` Mauro Carvalho Chehab
2022-06-26  9:53                     ` Mauro Carvalho Chehab
2022-06-27 15:28                       ` Liam Howlett
2022-06-27 15:54                         ` Christian Brauner
2022-06-27 16:27                         ` Mark Brown
2022-06-28 10:53                           ` Mauro Carvalho Chehab
2022-06-28 16:13                         ` Luck, Tony
2022-06-27 15:34                   ` Jonathan Corbet
2022-06-27 17:07                     ` Linus Torvalds
2022-07-01  8:48                       ` [PATCH 0/4] Address some issues with sphinx detection Mauro Carvalho Chehab
2022-07-01  8:48                         ` [PATCH 1/4] scripts: sphinx-pre-install: fix venv version check logic Mauro Carvalho Chehab
2022-07-01  8:48                         ` [PATCH 2/4] scripts: sphinx-pre-install: report broken venv Mauro Carvalho Chehab
2022-07-01  8:48                         ` [PATCH 3/4] scripts: sphinx-pre-install: check for PDF min version later on Mauro Carvalho Chehab
2022-07-01  8:48                         ` [PATCH 4/4] scripts: sphinx-pre-install: provide both venv and package installs Mauro Carvalho Chehab
2022-07-02 10:11                       ` [PATCH v2 0/5] Address some issues with sphinx detection Mauro Carvalho Chehab
2022-07-02 10:11                         ` Mauro Carvalho Chehab [this message]
2022-07-02 10:11                         ` [PATCH v2 2/5] scripts: sphinx-pre-install: report broken venv Mauro Carvalho Chehab
2022-07-02 10:11                         ` [PATCH v2 3/5] scripts: sphinx-pre-install: check for PDF min version later on Mauro Carvalho Chehab
2022-07-02 10:11                         ` [PATCH v2 4/5] scripts: sphinx-pre-install: provide both venv and package installs Mauro Carvalho Chehab
2022-07-02 10:11                         ` [PATCH v2 5/5] scripts: sphinx-pre-install: place a warning for Sphinx >= 3.0 Mauro Carvalho Chehab
2022-07-05  4:15                         ` [PATCH v2 0/5] Address some issues with sphinx detection Akira Yokosawa
2022-07-06 14:31                           ` Akira Yokosawa
2022-07-07 20:33                             ` Mauro Carvalho Chehab
2022-07-07 18:45                           ` Jonathan Corbet
2022-07-07 20:25                             ` Mauro Carvalho Chehab
2022-07-07 20:15                           ` Mauro Carvalho Chehab
2022-07-08 11:34                             ` Expectation to --no-pdf option (was Re: [PATCH v2 0/5] Address some issues with sphinx detection) Akira Yokosawa
2022-07-08 14:02                               ` Jonathan Corbet
2022-07-08 14:59                                 ` Mauro Carvalho Chehab
2022-07-08 15:27                                   ` Akira Yokosawa
2022-07-08 23:01                                     ` Akira Yokosawa
2022-07-09  7:59                                       ` Mauro Carvalho Chehab
2022-07-11 11:23                                         ` Akira Yokosawa
2022-08-01 23:30                         ` [PATCH v2 0/5] Address some issues with sphinx detection Tomasz Warniełło
2022-07-02 10:52                   ` [Ksummit-discuss] [TECH TOPIC] What kernel documentation could be Mauro Carvalho Chehab
2022-06-25 17:43 ` Steven Rostedt
2022-06-25 17:48   ` Laurent Pinchart

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=afe01b7863fd655986d84ace8948f3d7aede796d.1656756450.git.mchehab@kernel.org \
    --to=mchehab@kernel.org \
    --cc=corbet@lwn.net \
    --cc=ksummit-discuss@lists.linuxfoundation.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab+huawei@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.