All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] sphinx-pre-install improvements for Kernel 5.8
@ 2020-04-08 15:55 Mauro Carvalho Chehab
  2020-04-08 15:55 ` [PATCH 1/6] scripts: sphinx-pre-install: improve distro detection check Mauro Carvalho Chehab
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Mauro Carvalho Chehab @ 2020-04-08 15:55 UTC (permalink / raw)
  To: Linux Doc Mailing List
  Cc: Mauro Carvalho Chehab, linux-kernel, Jonathan Corbet, Tim Bird,
	Markus Heiser

This patch series is based on the discussions we had with regards to use

	python -m venv

to create python3 virtual machines.

After this series, the script will be smarter when detecting python3 and
python2.

As I had to re-test it with different distributions, it also do several
improvements and fixes at the detection logic and at the support for
some distributions that I don't use (except when testing this script)
and/or for some corner cases.

Mauro Carvalho Chehab (6):
  scripts: sphinx-pre-install: improve distro detection check
  scripts: sphinx-pre-install: improve openSuse Tumbleweed check
  scripts: sphinx-pre-install: fix a dependency hint with Ubuntu 16.04
  scripts: sphinx-pre-install: address some issues with Gentoo
  scripts: sphinx-pre-install: add support for OpenMandriva
  scripts: sphinx-pre-install: add support for python -m venv

 scripts/sphinx-pre-install | 168 +++++++++++++++++++++++++++----------
 1 file changed, 122 insertions(+), 46 deletions(-)

-- 
2.25.2



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/6] scripts: sphinx-pre-install: improve distro detection check
  2020-04-08 15:55 [PATCH 0/6] sphinx-pre-install improvements for Kernel 5.8 Mauro Carvalho Chehab
@ 2020-04-08 15:55 ` Mauro Carvalho Chehab
  2020-04-08 17:01   ` Bird, Tim
  2020-04-08 15:55 ` [PATCH 2/6] scripts: sphinx-pre-install: improve openSuse Tumbleweed check Mauro Carvalho Chehab
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 8+ messages in thread
From: Mauro Carvalho Chehab @ 2020-04-08 15:55 UTC (permalink / raw)
  To: Linux Doc Mailing List
  Cc: Mauro Carvalho Chehab, linux-kernel, Jonathan Corbet, Tim Bird,
	Markus Heiser

The Arch-linux detection is hit by catting /etc/issue, whose
contents is (nowadays):

	Arch Linux \r (\l)

It sounds a little ackward to print such string, so,
instead, let's use the /etc/os-release file, with exists
on lots of distributions and should provide a more reliable
result.

We'll keep the old tests before it, in order to avoid possible
regressions with the other distros, although the new way should
probably work on all the currently supported distributions.

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

diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install
index fa3fb05cd54b..c2071a1c69ea 100755
--- a/scripts/sphinx-pre-install
+++ b/scripts/sphinx-pre-install
@@ -780,6 +780,24 @@ $system_release = catcheck("/etc/system-release") if !$system_release;
 $system_release = catcheck("/etc/redhat-release") if !$system_release;
 $system_release = catcheck("/etc/lsb-release") if !$system_release;
 $system_release = catcheck("/etc/gentoo-release") if !$system_release;
+
+# This seems more common than LSB those days
+if (!$system_release) {
+	my %os_var;
+	if (open IN, "cat /etc/os-release|") {
+		while (<IN>) {
+			if (m/^([\w\d\_]+)=\"?([^\"]*)\"?\n/) {
+				$os_var{$1}=$2;
+			}
+		}
+		$system_release = $os_var{"NAME"};
+		if (defined($os_var{"VERSION_ID"})) {
+			$system_release .= " " . $os_var{"VERSION_ID"} if (defined($os_var{"VERSION_ID"}));
+		} else {
+			$system_release .= " " . $os_var{"VERSION"};
+		}
+	}
+}
 $system_release = catcheck("/etc/issue") if !$system_release;
 $system_release =~ s/\s+$//;
 
-- 
2.25.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/6] scripts: sphinx-pre-install: improve openSuse Tumbleweed check
  2020-04-08 15:55 [PATCH 0/6] sphinx-pre-install improvements for Kernel 5.8 Mauro Carvalho Chehab
  2020-04-08 15:55 ` [PATCH 1/6] scripts: sphinx-pre-install: improve distro detection check Mauro Carvalho Chehab
@ 2020-04-08 15:55 ` Mauro Carvalho Chehab
  2020-04-08 15:55 ` [PATCH 3/6] scripts: sphinx-pre-install: fix a dependency hint with Ubuntu 16.04 Mauro Carvalho Chehab
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Mauro Carvalho Chehab @ 2020-04-08 15:55 UTC (permalink / raw)
  To: Linux Doc Mailing List
  Cc: Mauro Carvalho Chehab, linux-kernel, Jonathan Corbet, Tim Bird,
	Markus Heiser

Currently, with openSUSE Tumbleweed 20200303, it keeps
recommending this forever:

	sudo zypper install --no-recommends rsvg-view

This dependency will never be fulfilled there, as the package
now is named as on other distros: rsvg-convert.

So, improve the detection to avoid such issue.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
 scripts/sphinx-pre-install | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install
index c2071a1c69ea..46c58a5795f1 100755
--- a/scripts/sphinx-pre-install
+++ b/scripts/sphinx-pre-install
@@ -446,9 +446,11 @@ sub give_opensuse_hints()
 		"convert"		=> "ImageMagick",
 		"Pod::Usage"		=> "perl-Pod-Usage",
 		"xelatex"		=> "texlive-xetex-bin",
-		"rsvg-convert"		=> "rsvg-view",
 	);
 
+	# On Tumbleweed, this package is also named rsvg-convert
+	$map{"rsvg-convert"} = "rsvg-view" if (!($system_release =~ /Tumbleweed/));
+
 	my @suse_tex_pkgs = (
 		"texlive-babel-english",
 		"texlive-caption",
-- 
2.25.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/6] scripts: sphinx-pre-install: fix a dependency hint with Ubuntu 16.04
  2020-04-08 15:55 [PATCH 0/6] sphinx-pre-install improvements for Kernel 5.8 Mauro Carvalho Chehab
  2020-04-08 15:55 ` [PATCH 1/6] scripts: sphinx-pre-install: improve distro detection check Mauro Carvalho Chehab
  2020-04-08 15:55 ` [PATCH 2/6] scripts: sphinx-pre-install: improve openSuse Tumbleweed check Mauro Carvalho Chehab
@ 2020-04-08 15:55 ` Mauro Carvalho Chehab
  2020-04-08 15:55 ` [PATCH 4/6] scripts: sphinx-pre-install: address some issues with Gentoo Mauro Carvalho Chehab
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Mauro Carvalho Chehab @ 2020-04-08 15:55 UTC (permalink / raw)
  To: Linux Doc Mailing List
  Cc: Mauro Carvalho Chehab, linux-kernel, Jonathan Corbet, Tim Bird,
	Markus Heiser

Avoid the scripts to keep asking to install fonts-noto-cjk
on Ubuntu 16.04.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
 scripts/sphinx-pre-install | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install
index 46c58a5795f1..7234482475a3 100755
--- a/scripts/sphinx-pre-install
+++ b/scripts/sphinx-pre-install
@@ -349,7 +349,8 @@ sub give_debian_hints()
 				   "fonts-dejavu", 2);
 
 		check_missing_file(["/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc",
-				   "/usr/share/fonts/opentype/noto/NotoSerifCJK-Regular.ttc"],
+				    "/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc",
+				    "/usr/share/fonts/opentype/noto/NotoSerifCJK-Regular.ttc"],
 				   "fonts-noto-cjk", 2);
 	}
 
-- 
2.25.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/6] scripts: sphinx-pre-install: address some issues with Gentoo
  2020-04-08 15:55 [PATCH 0/6] sphinx-pre-install improvements for Kernel 5.8 Mauro Carvalho Chehab
                   ` (2 preceding siblings ...)
  2020-04-08 15:55 ` [PATCH 3/6] scripts: sphinx-pre-install: fix a dependency hint with Ubuntu 16.04 Mauro Carvalho Chehab
@ 2020-04-08 15:55 ` Mauro Carvalho Chehab
  2020-04-08 15:55 ` [PATCH 5/6] scripts: sphinx-pre-install: add support for OpenMandriva Mauro Carvalho Chehab
  2020-04-08 15:55 ` [PATCH 6/6] scripts: sphinx-pre-install: add support for python -m venv Mauro Carvalho Chehab
  5 siblings, 0 replies; 8+ messages in thread
From: Mauro Carvalho Chehab @ 2020-04-08 15:55 UTC (permalink / raw)
  To: Linux Doc Mailing List
  Cc: Mauro Carvalho Chehab, linux-kernel, Jonathan Corbet, Tim Bird,
	Markus Heiser

There are some small misdetections with Gentoo. While they
don't cause too much trouble, it keeps recomending to
install things that are already there.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
 scripts/sphinx-pre-install | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install
index 7234482475a3..3ae732a028db 100755
--- a/scripts/sphinx-pre-install
+++ b/scripts/sphinx-pre-install
@@ -560,7 +560,8 @@ sub give_gentoo_hints()
 			   "media-fonts/dejavu", 2) if ($pdf);
 
 	if ($pdf) {
-		check_missing_file(["/usr/share/fonts/noto-cjk/NotoSansCJKsc-Regular.otf"],
+		check_missing_file(["/usr/share/fonts/noto-cjk/NotoSansCJKsc-Regular.otf",
+				    "/usr/share/fonts/noto-cjk/NotoSerifCJK-Regular.ttc"],
 				   "media-fonts/noto-cjk", 2);
 	}
 
@@ -575,10 +576,10 @@ sub give_gentoo_hints()
 	my $portage_imagemagick = "/etc/portage/package.use/imagemagick";
 	my $portage_cairo = "/etc/portage/package.use/graphviz";
 
-	if (qx(cat $portage_imagemagick) ne "$imagemagick\n") {
+	if (qx(grep imagemagick $portage_imagemagick 2>/dev/null) eq "") {
 		printf("\tsudo su -c 'echo \"$imagemagick\" > $portage_imagemagick'\n")
 	}
-	if (qx(cat $portage_cairo) ne  "$cairo\n") {
+	if (qx(grep graphviz $portage_cairo 2>/dev/null) eq  "") {
 		printf("\tsudo su -c 'echo \"$cairo\" > $portage_cairo'\n");
 	}
 
-- 
2.25.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 5/6] scripts: sphinx-pre-install: add support for OpenMandriva
  2020-04-08 15:55 [PATCH 0/6] sphinx-pre-install improvements for Kernel 5.8 Mauro Carvalho Chehab
                   ` (3 preceding siblings ...)
  2020-04-08 15:55 ` [PATCH 4/6] scripts: sphinx-pre-install: address some issues with Gentoo Mauro Carvalho Chehab
@ 2020-04-08 15:55 ` Mauro Carvalho Chehab
  2020-04-08 15:55 ` [PATCH 6/6] scripts: sphinx-pre-install: add support for python -m venv Mauro Carvalho Chehab
  5 siblings, 0 replies; 8+ messages in thread
From: Mauro Carvalho Chehab @ 2020-04-08 15:55 UTC (permalink / raw)
  To: Linux Doc Mailing List
  Cc: Mauro Carvalho Chehab, linux-kernel, Jonathan Corbet, Tim Bird,
	Markus Heiser

It seems that Mageia and OpenMandriva will reunite on a single
distribution. In any case, both came from Mandriva. So, it is
close enough to use the same logic.

So, add support for it.

Tested with OpenMandriva 4.1 and with Mageia 7.1.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
 scripts/sphinx-pre-install | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install
index 3ae732a028db..dab8e3daeed7 100755
--- a/scripts/sphinx-pre-install
+++ b/scripts/sphinx-pre-install
@@ -494,7 +494,7 @@ sub give_mageia_hints()
 		"convert"		=> "ImageMagick",
 		"Pod::Usage"		=> "perl-Pod-Usage",
 		"xelatex"		=> "texlive",
-		"rsvg-convert"		=> "librsvg2-tools",
+		"rsvg-convert"		=> "librsvg2",
 	);
 
 	my @tex_pkgs = (
@@ -503,16 +503,29 @@ sub give_mageia_hints()
 
 	$map{"latexmk"} = "texlive-collection-basic";
 
+	my $packager_cmd;
+	my $noto_sans;
+	if ($system_release =~ /OpenMandriva/) {
+		$packager_cmd = "dnf install";
+		$noto_sans = "noto-sans-cjk-fonts";
+		@tex_pkgs = ( "texlive-collection-fontsextra" );
+	} else {
+		$packager_cmd = "urpmi";
+		$noto_sans = "google-noto-sans-cjk-ttc-fonts";
+	}
+
+
 	if ($pdf) {
-		check_missing_file(["/usr/share/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc"],
-				   "google-noto-sans-cjk-ttc-fonts", 2);
+		check_missing_file(["/usr/share/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc",
+				    "/usr/share/fonts/TTF/NotoSans-Regular.ttf"],
+				   $noto_sans, 2);
 	}
 
 	check_rpm_missing(\@tex_pkgs, 2) if ($pdf);
 	check_missing(\%map);
 
 	return if (!$need && !$optional);
-	printf("You should run:\n\n\tsudo urpmi $install\n");
+	printf("You should run:\n\n\tsudo $packager_cmd $install\n");
 }
 
 sub give_arch_linux_hints()
@@ -626,6 +639,10 @@ sub check_distros()
 		give_mageia_hints;
 		return;
 	}
+	if ($system_release =~ /OpenMandriva/) {
+		give_mageia_hints;
+		return;
+	}
 	if ($system_release =~ /Arch Linux/) {
 		give_arch_linux_hints;
 		return;
-- 
2.25.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 6/6] scripts: sphinx-pre-install: add support for python -m venv
  2020-04-08 15:55 [PATCH 0/6] sphinx-pre-install improvements for Kernel 5.8 Mauro Carvalho Chehab
                   ` (4 preceding siblings ...)
  2020-04-08 15:55 ` [PATCH 5/6] scripts: sphinx-pre-install: add support for OpenMandriva Mauro Carvalho Chehab
@ 2020-04-08 15:55 ` Mauro Carvalho Chehab
  5 siblings, 0 replies; 8+ messages in thread
From: Mauro Carvalho Chehab @ 2020-04-08 15:55 UTC (permalink / raw)
  To: Linux Doc Mailing List
  Cc: Mauro Carvalho Chehab, linux-kernel, Jonathan Corbet, Tim Bird,
	Markus Heiser

Since python 3.3, the recommended way to setup a virtual env is
via "python -m venv".

Set this as a default, if python version is compatible with
such feature.

While here, add more comments to it, as the script is
getting more complex. So, better to add more things, to avoid
accidentally breaking it while improving it.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
 scripts/sphinx-pre-install | 111 ++++++++++++++++++++++++-------------
 1 file changed, 74 insertions(+), 37 deletions(-)

diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install
index dab8e3daeed7..54bd8a2bfe70 100755
--- a/scripts/sphinx-pre-install
+++ b/scripts/sphinx-pre-install
@@ -2,7 +2,7 @@
 # SPDX-License-Identifier: GPL-2.0-or-later
 use strict;
 
-# Copyright (c) 2017-2019 Mauro Carvalho Chehab <mchehab@kernel.org>
+# Copyright (c) 2017-2020 Mauro Carvalho Chehab <mchehab@kernel.org>
 #
 
 my $prefix = "./";
@@ -22,9 +22,12 @@ my $need = 0;
 my $optional = 0;
 my $need_symlink = 0;
 my $need_sphinx = 0;
+my $need_venv = 0;
+my $need_virtualenv = 0;
 my $rec_sphinx_upgrade = 0;
 my $install = "";
 my $virtenv_dir = "";
+my $python_cmd = "";
 my $min_version;
 
 #
@@ -147,7 +150,7 @@ sub check_program($$)
 	my $prog = shift;
 	my $is_optional = shift;
 
-	return if findprog($prog);
+	return $prog if findprog($prog);
 
 	add_package($prog, $is_optional);
 }
@@ -168,9 +171,9 @@ sub check_python_module($$)
 	my $prog = shift;
 	my $is_optional = shift;
 
-	my $err = system("python3 -c 'import $prog' 2>/dev/null /dev/null");
-	return if ($err == 0);
-	my $err = system("python -c 'import $prog' 2>/dev/null /dev/null");
+	return if (!$python_cmd);
+
+	my $err = system("$python_cmd -c 'import $prog' 2>/dev/null /dev/null");
 	return if ($err == 0);
 
 	add_package($prog, $is_optional);
@@ -225,16 +228,6 @@ sub get_sphinx_fname()
 		return $fname;
 	}
 
-	if ($virtualenv) {
-		my $prog = findprog("virtualenv-3");
-		$prog = findprog("virtualenv-3.5") if (!$prog);
-
-		check_program("virtualenv", 0) if (!$prog);
-		$need_sphinx = 1;
-	} else {
-		add_package("python-sphinx", 0);
-	}
-
 	return "";
 }
 
@@ -268,7 +261,10 @@ sub check_sphinx()
 	$virtenv_dir = $virtenv_prefix . $rec_version;
 
 	my $sphinx = get_sphinx_fname();
-	return if ($sphinx eq "");
+	if ($sphinx eq "") {
+		$need_sphinx = 1;
+		return;
+	}
 
 	open IN, "$sphinx --version 2>&1 |" or die "$sphinx returned an error";
 	while (<IN>) {
@@ -336,6 +332,7 @@ sub give_debian_hints()
 	my %map = (
 		"python-sphinx"		=> "python3-sphinx",
 		"sphinx_rtd_theme"	=> "python3-sphinx-rtd-theme",
+		"ensurepip"		=> "python3-venv",
 		"virtualenv"		=> "virtualenv",
 		"dot"			=> "graphviz",
 		"convert"		=> "imagemagick",
@@ -672,13 +669,13 @@ sub check_distros()
 
 sub deactivate_help()
 {
-	printf "\tIf you want to exit the virtualenv, you can use:\n";
+	printf "\nIf you want to exit the virtualenv, you can use:\n";
 	printf "\tdeactivate\n";
 }
 
 sub check_needs()
 {
-	# Check for needed programs/tools
+	# Check if Sphinx is already accessible from current environment
 	check_sphinx();
 
 	if ($system_release) {
@@ -689,6 +686,43 @@ sub check_needs()
 
 	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);
+
+	# Check the type of virtual env, depending on Python version
+	if ($python_cmd) {
+		if ($virtualenv) {
+			my $tmp = qx($python_cmd --version 2>&1);
+			if ($tmp =~ m/(\d+\.)(\d+\.)/) {
+				if ($1 >= 3 && $2 >= 3) {
+					$need_venv = 1;		# python 3.3 or upper
+				} else {
+					$need_virtualenv = 1;
+				}
+				if ($1 < 3) {
+					# Complain if it finds python2 (or worse)
+					printf "Warning: python$1 support is deprecated. Use it with caution!\n";
+				}
+			} else {
+				die "Warning: couldn't identify $python_cmd version!";
+			}
+		} else {
+			add_package("python-sphinx", 0);
+		}
+	}
+
+	# Set virtualenv command line, if python < 3.3
+	my $virtualenv_cmd;
+	if ($need_virtualenv) {
+		$virtualenv_cmd = findprog("virtualenv-3");
+		$virtualenv_cmd = findprog("virtualenv-3.5") if (!$virtualenv_cmd);
+		if (!$virtualenv_cmd) {
+			check_program("virtualenv", 0);
+			$virtualenv_cmd = "virtualenv";
+		}
+	}
+
 	# Check for needed programs/tools
 	check_perl_module("Pod::Usage", 0);
 	check_program("make", 0);
@@ -702,12 +736,30 @@ sub check_needs()
 	check_program("rsvg-convert", 2) if ($pdf);
 	check_program("latexmk", 2) if ($pdf);
 
+	if ($need_sphinx || $rec_sphinx_upgrade) {
+		check_python_module("ensurepip", 0) if ($need_venv);
+	}
+
+	# Do distro-specific checks and output distro-install commands
 	check_distros();
 
+	if (!$python_cmd) {
+		if ($need == 1) {
+			die "Can't build as $need mandatory dependency is missing";
+		} elsif ($need) {
+			die "Can't build as $need mandatory dependencies are missing";
+		}
+	}
+
+	# Check if sphinx-build is called sphinx-build-3
 	if ($need_symlink) {
 		printf "\tsudo ln -sf %s /usr/bin/sphinx-build\n\n",
 		       which("sphinx-build-3");
 	}
+
+	# NOTE: if the system has a too old Sphinx version installed,
+	# it will recommend installing a newer version using virtualenv
+
 	if ($need_sphinx || $rec_sphinx_upgrade) {
 		my $min_activate = "$ENV{'PWD'}/${virtenv_prefix}${min_version}/bin/activate";
 		my @activates = glob "$ENV{'PWD'}/${virtenv_prefix}*/bin/activate";
@@ -721,27 +773,12 @@ sub check_needs()
 			exit (1);
 		} else {
 			my $rec_activate = "$virtenv_dir/bin/activate";
-			my $virtualenv = findprog("virtualenv-3");
-			my $rec_python3 = "";
-			$virtualenv = findprog("virtualenv-3.5") if (!$virtualenv);
-			$virtualenv = findprog("virtualenv") if (!$virtualenv);
-			$virtualenv = "virtualenv" if (!$virtualenv);
 
-			my $rel = "";
-			if (index($system_release, "Ubuntu") != -1) {
-				$rel = $1 if ($system_release =~ /Ubuntu\s+(\d+)[.]/);
-				if ($rel && $rel >= 16) {
-					$rec_python3 = " -p python3";
-				}
+			if ($need_venv) {
+				printf "\t$python_cmd -m venv $virtenv_dir\n";
+			} else {
+				printf "\t$virtualenv_cmd $virtenv_dir\n";
 			}
-			if (index($system_release, "Debian") != -1) {
-				$rel = $1 if ($system_release =~ /Debian\s+(\d+)/);
-				if ($rel && $rel >= 7) {
-					$rec_python3 = " -p python3";
-				}
-			}
-
-			printf "\t$virtualenv$rec_python3 $virtenv_dir\n";
 			printf "\t. $rec_activate\n";
 			printf "\tpip install -r $requirement_file\n";
 			deactivate_help();
-- 
2.25.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* RE: [PATCH 1/6] scripts: sphinx-pre-install: improve distro detection check
  2020-04-08 15:55 ` [PATCH 1/6] scripts: sphinx-pre-install: improve distro detection check Mauro Carvalho Chehab
@ 2020-04-08 17:01   ` Bird, Tim
  0 siblings, 0 replies; 8+ messages in thread
From: Bird, Tim @ 2020-04-08 17:01 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Linux Doc Mailing List
  Cc: linux-kernel, Jonathan Corbet, Markus Heiser



> -----Original Message-----
> From: Mauro Carvalho Chehab <mchehab@kernel.org> On Behalf Of Mauro Carvalho Chehab
> 
> The Arch-linux detection is hit by catting /etc/issue, whose
> contents is (nowadays):
> 
> 	Arch Linux \r (\l)
> 
> It sounds a little ackward to print such string, so,
> instead, let's use the /etc/os-release file, with exists
> on lots of distributions and should provide a more reliable
> result.
> 
> We'll keep the old tests before it, in order to avoid possible
> regressions with the other distros, although the new way should
> probably work on all the currently supported distributions.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
> ---
>  scripts/sphinx-pre-install | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install
> index fa3fb05cd54b..c2071a1c69ea 100755
> --- a/scripts/sphinx-pre-install
> +++ b/scripts/sphinx-pre-install
> @@ -780,6 +780,24 @@ $system_release = catcheck("/etc/system-release") if !$system_release;
>  $system_release = catcheck("/etc/redhat-release") if !$system_release;
>  $system_release = catcheck("/etc/lsb-release") if !$system_release;
>  $system_release = catcheck("/etc/gentoo-release") if !$system_release;
> +
> +# This seems more common than LSB those days
should 'those' be 'these'?

> +if (!$system_release) {
> +	my %os_var;
> +	if (open IN, "cat /etc/os-release|") {
> +		while (<IN>) {
> +			if (m/^([\w\d\_]+)=\"?([^\"]*)\"?\n/) {
> +				$os_var{$1}=$2;
> +			}
> +		}
> +		$system_release = $os_var{"NAME"};
> +		if (defined($os_var{"VERSION_ID"})) {
> +			$system_release .= " " . $os_var{"VERSION_ID"} if (defined($os_var{"VERSION_ID"}));
> +		} else {
> +			$system_release .= " " . $os_var{"VERSION"};
> +		}
> +	}
> +}
>  $system_release = catcheck("/etc/issue") if !$system_release;
>  $system_release =~ s/\s+$//;
> 
> --
> 2.25.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-04-08 17:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-08 15:55 [PATCH 0/6] sphinx-pre-install improvements for Kernel 5.8 Mauro Carvalho Chehab
2020-04-08 15:55 ` [PATCH 1/6] scripts: sphinx-pre-install: improve distro detection check Mauro Carvalho Chehab
2020-04-08 17:01   ` Bird, Tim
2020-04-08 15:55 ` [PATCH 2/6] scripts: sphinx-pre-install: improve openSuse Tumbleweed check Mauro Carvalho Chehab
2020-04-08 15:55 ` [PATCH 3/6] scripts: sphinx-pre-install: fix a dependency hint with Ubuntu 16.04 Mauro Carvalho Chehab
2020-04-08 15:55 ` [PATCH 4/6] scripts: sphinx-pre-install: address some issues with Gentoo Mauro Carvalho Chehab
2020-04-08 15:55 ` [PATCH 5/6] scripts: sphinx-pre-install: add support for OpenMandriva Mauro Carvalho Chehab
2020-04-08 15:55 ` [PATCH 6/6] scripts: sphinx-pre-install: add support for python -m venv Mauro Carvalho Chehab

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.