lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <bcf79d0399a1c3444ca938dcdce599c3273980ab.1587478901.git.mchehab+huawei@kernel.org>
Date:   Tue, 21 Apr 2020 16:31:07 +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>,
        linux-kernel@...r.kernel.org, Jonathan Corbet <corbet@....net>
Subject: [PATCH 3/5] scripts: sphinx-pre-install: change recommendation text if venv exists

If one is running a Sphinx version older than what's recommended,
but there's already a newer working virtual env, change the
text, as it is just a matter of switching to the new venv, instead
of creating a new one from scratch.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
---
 scripts/sphinx-pre-install | 34 ++++++++++++++++++++++------------
 1 file changed, 22 insertions(+), 12 deletions(-)

diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install
index 0d5684c08bbc..938b65d40fc8 100755
--- a/scripts/sphinx-pre-install
+++ b/scripts/sphinx-pre-install
@@ -29,6 +29,7 @@ my $install = "";
 my $virtenv_dir = "";
 my $python_cmd = "";
 my $min_version;
+my $cur_version;
 my $rec_version = "1.7.9";	# PDF won't build here
 my $min_pdf_version = "2.4.4";	# Min version where pdf builds
 
@@ -257,7 +258,6 @@ sub get_sphinx_version($)
 sub check_sphinx()
 {
 	my $default_version;
-	my $cur_version;
 
 	open IN, $conf or die "Can't open $conf";
 	while (<IN>) {
@@ -703,8 +703,6 @@ sub check_needs()
 		print "Unknown OS\n\n";
 	}
 
-	print "To upgrade Sphinx, use:\n\n" if ($rec_sphinx_upgrade);
-
 	# Check python command line, trying first python3
 	$python_cmd = findprog("python3");
 	$python_cmd = check_program("python", 0) if (!$python_cmd);
@@ -786,24 +784,36 @@ sub check_needs()
 		@activates = sort {$b cmp $a} @activates;
 		my ($activate, $ver);
 		foreach my $f (@activates) {
-			$activate = $f;
-			next if ($activate lt $min_activate);
+			next if ($f lt $min_activate);
 
-			my $sphinx_cmd = $activate;
+			my $sphinx_cmd = $f;
 			$sphinx_cmd =~ s/activate/sphinx-build/;
 			next if (! -f $sphinx_cmd);
 
 			$ver = get_sphinx_version($sphinx_cmd);
-			last if ($ver ge $min_version);
+			if ($need_sphinx && ($ver ge $min_version)) {
+				$activate = $f;
+				last;
+			} elsif ($ver gt $cur_version) {
+				$activate = $f;
+				last;
+			}
 		}
-		if ($need_sphinx && ($activate ne "")) {
-			printf "\nNeed to activate Sphinx (version $ver) on virtualenv with:\n";
-			printf "\t. $activate\n";
-			deactivate_help();
-			exit (1);
+		if ($activate ne "") {
+			if ($need_sphinx) {
+				printf "\nNeed to activate Sphinx (version $ver) on virtualenv with:\n";
+				printf "\t. $activate\n";
+				deactivate_help();
+				exit (1);
+			} else {
+				printf "\nYou may also use a newer Sphinx (version $ver) with:\n";
+				printf "\tdeactivate && . $activate\n";
+			}
 		} else {
 			my $rec_activate = "$virtenv_dir/bin/activate";
 
+			print "To upgrade Sphinx, use:\n\n" if ($rec_sphinx_upgrade);
+
 			if ($need_venv) {
 				printf "\t$python_cmd -m venv $virtenv_dir\n";
 			} else {
-- 
2.25.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ