RHEL 7.x and clone distros are shipped with Sphinx 1.1.x,
with is incompatible with Kernel ReST markups.
So, on those systems, the only alternative is to install
it via a Python virtual environment.
While seeking for "pip" on CentOS 7.3, I noticed that it
is not really needed, as python-virtualenv has its version
packaged there already. So, remove this from the list of
requirements for all distributions.
With regards to PDF, twe need at least texlive-tabulary
extension, but that is not shipped there (at least on
CentOS). So, disable PDF packages as a hole.
Please notice, however, that texlive + amsmath is needed for
ReST to properly handle ReST ".. math::" tags. Yet, Sphinx
fall back to display the LaTeX math expressions as-is, if
such extension is not available.
So, let's just disable all texlive packages as a hole.
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---
This patch comes after this patch:
[PATCH] sphinx-pre-install: add support for Mageia
and after this series
[PATCH v2 0/8] Add a script to check for Sphinx install requirements
The full patch series is available at:
https://git.linuxtv.org/mchehab/experimental.git/log/?h=sphinx_install_v2
scripts/sphinx-pre-install | 54 +++++++++++++++++++++++++++++++++++-----------
1 file changed, 42 insertions(+), 12 deletions(-)
diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install
index 5d2799dcfceb..677756ae34c9 100755
--- a/scripts/sphinx-pre-install
+++ b/scripts/sphinx-pre-install
@@ -216,7 +216,6 @@ sub check_sphinx()
$prog = findprog("virtualenv-3.5") if (!$prog);
check_program("virtualenv", 0) if (!$prog);
- check_program("pip", 0) if (!findprog("pip3"));
$need_sphinx = 1;
} else {
add_package("python-sphinx", 0);
@@ -256,7 +255,6 @@ sub give_debian_hints()
"python-sphinx" => "python3-sphinx",
"sphinx_rtd_theme" => "python3-sphinx-rtd-theme",
"virtualenv" => "virtualenv",
- "pip" => "python3-pip",
"dot" => "graphviz",
"convert" => "imagemagick",
"Pod::Usage" => "perl-modules",
@@ -282,7 +280,6 @@ sub give_redhat_hints()
"python-sphinx" => "python3-sphinx",
"sphinx_rtd_theme" => "python3-sphinx_rtd_theme",
"virtualenv" => "python3-virtualenv",
- "pip" => "python3-pip",
"dot" => "graphviz",
"convert" => "ImageMagick",
"Pod::Usage" => "perl-Pod-Usage",
@@ -302,6 +299,13 @@ sub give_redhat_hints()
"dejavu-sans-mono-fonts",
);
+ #
+ # Checks valid for RHEL/CentOS version 7.x.
+ #
+ if (! $system_release =~ /Fedora/) {
+ $map{"virtualenv"} = "python-virtualenv";
+ }
+
my $release;
$release = $1 if ($system_release =~ /Fedora\s+release\s+(\d+)/);
@@ -312,7 +316,14 @@ sub give_redhat_hints()
check_missing(\%map);
return if (!$need && !$optional);
- printf("You should run:\n\n\tsudo dnf install -y $install\n");
+
+ if ($release >= 18) {
+ # dnf, for Fedora 18+
+ printf("You should run:\n\n\tsudo dnf install -y $install\n");
+ } else {
+ # yum, for RHEL (and clones) or Fedora version < 18
+ printf("You should run:\n\n\tsudo yum install -y $install\n");
+ }
}
sub give_opensuse_hints()
@@ -321,7 +332,6 @@ sub give_opensuse_hints()
"python-sphinx" => "python3-sphinx",
"sphinx_rtd_theme" => "python3-sphinx_rtd_theme",
"virtualenv" => "python3-virtualenv",
- "pip" => "python3-pip",
"dot" => "graphviz",
"convert" => "ImageMagick",
"Pod::Usage" => "perl-Pod-Usage",
@@ -360,7 +370,6 @@ sub give_mageia_hints()
"python-sphinx" => "python3-sphinx",
"sphinx_rtd_theme" => "python3-sphinx_rtd_theme",
"virtualenv" => "python3-virtualenv",
- "pip" => "python3-pip",
"dot" => "graphviz",
"convert" => "ImageMagick",
"Pod::Usage" => "perl-Pod-Usage",
@@ -372,8 +381,6 @@ sub give_mageia_hints()
"texlive-fontsextra",
);
- my $release;
-
check_rpm_missing(\@tex_pkgs, 1) if ($pdf);
check_missing(\%map);
@@ -386,7 +393,6 @@ sub give_arch_linux_hints()
my %map = (
"sphinx_rtd_theme" => "python-sphinx_rtd_theme",
"virtualenv" => "python-virtualenv",
- "pip" => "python-pip",
"dot" => "graphviz",
"convert" => "imagemagick",
"xelatex" => "texlive-bin",
@@ -410,7 +416,6 @@ sub give_gentoo_hints()
my %map = (
"sphinx_rtd_theme" => "dev-python/sphinx_rtd_theme",
"virtualenv" => "dev-python/virtualenv",
- "pip" => "dev-python/pip",
"dot" => "media-gfx/graphviz",
"convert" => "media-gfx/imagemagick",
"xelatex" => "dev-texlive/texlive-xetex media-fonts/dejavu",
@@ -438,6 +443,18 @@ sub check_distros()
give_redhat_hints;
return;
}
+ if ($system_release =~ /CentOS/) {
+ give_redhat_hints;
+ return;
+ }
+ if ($system_release =~ /Scientific Linux/) {
+ give_redhat_hints;
+ return;
+ }
+ if ($system_release =~ /Oracle Linux Server/) {
+ give_redhat_hints;
+ return;
+ }
if ($system_release =~ /Fedora/) {
give_redhat_hints;
return;
@@ -488,9 +505,22 @@ sub check_distros()
sub check_needs()
{
if ($system_release) {
- print "Checking if the needed tools for $system_release are available\n";
+ print "Detected OS: $system_release.\n";
} else {
- print "Checking if the needed tools are present\n";
+ print "Unknown OS\n";
+ }
+
+ # RHEL 7.x and clones have Sphinx version 1.1.x and incomplete texlive
+ if (($system_release =~ /Red Hat Enterprise Linux/) ||
+ ($system_release =~ /CentOS/) ||
+ ($system_release =~ /Scientific Linux/) ||
+ ($system_release =~ /Oracle Linux Server/)) {
+ $virtualenv = 1;
+ $pdf = 0;
+
+ printf("NOTE: On this distro, Sphinx and TexLive shipped versions are incompatible\n");
+ printf("with doc build. So, use Sphinx via a Python virtual environment.\n\n");
+ printf("This script can't install a TexLive version that would provide PDF.\n");
}
# Check for needed programs/tools
--
2.13.3
On Mon, 24 Jul 2017 09:09:24 -0300
Mauro Carvalho Chehab <[email protected]> wrote:
> RHEL 7.x and clone distros are shipped with Sphinx 1.1.x,
> with is incompatible with Kernel ReST markups.
>
> So, on those systems, the only alternative is to install
> it via a Python virtual environment.
>
> While seeking for "pip" on CentOS 7.3, I noticed that it
> is not really needed, as python-virtualenv has its version
> packaged there already. So, remove this from the list of
> requirements for all distributions.
>
> With regards to PDF, twe need at least texlive-tabulary
> extension, but that is not shipped there (at least on
> CentOS). So, disable PDF packages as a hole.
>
> Please notice, however, that texlive + amsmath is needed for
> ReST to properly handle ReST ".. math::" tags. Yet, Sphinx
> fall back to display the LaTeX math expressions as-is, if
> such extension is not available.
>
> So, let's just disable all texlive packages as a hole.
I've applied this, finally. Couldn't resist the temptation to fix "as a
whole" while I was at it :)
Thanks,
jon
Em Mon, 7 Aug 2017 14:27:33 -0600
Jonathan Corbet <[email protected]> escreveu:
> On Mon, 24 Jul 2017 09:09:24 -0300
> Mauro Carvalho Chehab <[email protected]> wrote:
>
> > RHEL 7.x and clone distros are shipped with Sphinx 1.1.x,
> > with is incompatible with Kernel ReST markups.
> >
> > So, on those systems, the only alternative is to install
> > it via a Python virtual environment.
> >
> > While seeking for "pip" on CentOS 7.3, I noticed that it
> > is not really needed, as python-virtualenv has its version
> > packaged there already. So, remove this from the list of
> > requirements for all distributions.
> >
> > With regards to PDF, twe need at least texlive-tabulary
> > extension, but that is not shipped there (at least on
> > CentOS). So, disable PDF packages as a hole.
> >
> > Please notice, however, that texlive + amsmath is needed for
> > ReST to properly handle ReST ".. math::" tags. Yet, Sphinx
> > fall back to display the LaTeX math expressions as-is, if
> > such extension is not available.
> >
> > So, let's just disable all texlive packages as a hole.
>
> I've applied this, finally. Couldn't resist the temptation to fix "as a
> whole" while I was at it :)
Thanks for applying - and for fixing the "whole" typo ;)
Yeah, RHEL/CentOS was likely the big missing gap at the script. With time,
people may end adding other distros there too. As most distros either
use .deb or .rpm packaging[1], I suspect it shouldn't be hard to add support
for them when needed, as they'll end by either use the existing logic,
or require a close enough logic.
[1] Well, last time I checked, Slackware still use tarballs. Slackware
was the first distro I used, back on Kernel 1.0 days. If I ever become
nostalgic enough, I might eventually write a patch for it some day.
Thanks,
Mauro