History

scripts/sphinx-pre-install: add minimum support for RHEL

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, we need at least texlive-tabulary extension, but that is not shipped there (at least on CentOS). So, disable PDF packages as a whole. 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 whole.

Mauro Carvalho Chehab committed 9 years ago

Commit 9b756a91 parent 3d91a351 file · +42 −12Browse files

Unified · Split

scripts/sphinx-pre-install+42−12
@@ -216,7 +216,6 @@ sub check_sphinx() · 215 unmodified lines
216216 $prog = findprog("virtualenv-3.5") if (!$prog);
217217
218218 check_program("virtualenv", 0) if (!$prog);
219− check_program("pip", 0) if (!findprog("pip3"));
220219 $need_sphinx = 1;
221220 } else {
222221 add_package("python-sphinx", 0);
@@ -256,7 +255,6 @@ sub give_debian_hints() · 33 unmodified lines
256255 "python-sphinx" => "python3-sphinx",
257256 "sphinx_rtd_theme" => "python3-sphinx-rtd-theme",
258257 "virtualenv" => "virtualenv",
259− "pip" => "python3-pip",
260258 "dot" => "graphviz",
261259 "convert" => "imagemagick",
262260 "Pod::Usage" => "perl-modules",
@@ -282,7 +280,6 @@ sub give_redhat_hints() · 19 unmodified lines
282280 "python-sphinx" => "python3-sphinx",
283281 "sphinx_rtd_theme" => "python3-sphinx_rtd_theme",
284282 "virtualenv" => "python3-virtualenv",
285− "pip" => "python3-pip",
286283 "dot" => "graphviz",
287284 "convert" => "ImageMagick",
288285 "Pod::Usage" => "perl-Pod-Usage",
@@ -302,6 +299,13 @@ sub give_redhat_hints() · 13 unmodified lines
302299 "dejavu-sans-mono-fonts",
303300 );
304301
302+ #
303+ # Checks valid for RHEL/CentOS version 7.x.
304+ #
305+ if (! $system_release =~ /Fedora/) {
306+ $map{"virtualenv"} = "python-virtualenv";
307+ }
308+
305309 my $release;
306310
307311 $release = $1 if ($system_release =~ /Fedora\s+release\s+(\d+)/);
@@ -312,7 +316,14 @@ sub give_redhat_hints() · 4 unmodified lines
312316 check_missing(\%map);
313317
314318 return if (!$need && !$optional);
315− printf("You should run:\n\n\tsudo dnf install -y $install\n");
319+
320+ if ($release >= 18) {
321+ # dnf, for Fedora 18+
322+ printf("You should run:\n\n\tsudo dnf install -y $install\n");
323+ } else {
324+ # yum, for RHEL (and clones) or Fedora version < 18
325+ printf("You should run:\n\n\tsudo yum install -y $install\n");
326+ }
316327 }
317328
318329 sub give_opensuse_hints()
@@ -321,7 +332,6 @@ sub give_opensuse_hints() · 2 unmodified lines
321332 "python-sphinx" => "python3-sphinx",
322333 "sphinx_rtd_theme" => "python3-sphinx_rtd_theme",
323334 "virtualenv" => "python3-virtualenv",
324− "pip" => "python3-pip",
325335 "dot" => "graphviz",
326336 "convert" => "ImageMagick",
327337 "Pod::Usage" => "perl-Pod-Usage",
@@ -360,7 +370,6 @@ sub give_mageia_hints() · 32 unmodified lines
360370 "python-sphinx" => "python3-sphinx",
361371 "sphinx_rtd_theme" => "python3-sphinx_rtd_theme",
362372 "virtualenv" => "python3-virtualenv",
363− "pip" => "python3-pip",
364373 "dot" => "graphviz",
365374 "convert" => "ImageMagick",
366375 "Pod::Usage" => "perl-Pod-Usage",
@@ -372,8 +381,6 @@ sub give_mageia_hints() · 5 unmodified lines
372381 "texlive-fontsextra",
373382 );
374383
375− my $release;
376−
377384 check_rpm_missing(\@tex_pkgs, 1) if ($pdf);
378385 check_missing(\%map);
379386
@@ -386,7 +393,6 @@ sub give_arch_linux_hints() · 6 unmodified lines
386393 my %map = (
387394 "sphinx_rtd_theme" => "python-sphinx_rtd_theme",
388395 "virtualenv" => "python-virtualenv",
389− "pip" => "python-pip",
390396 "dot" => "graphviz",
391397 "convert" => "imagemagick",
392398 "xelatex" => "texlive-bin",
@@ -410,7 +416,6 @@ sub give_gentoo_hints() · 17 unmodified lines
410416 my %map = (
411417 "sphinx_rtd_theme" => "dev-python/sphinx_rtd_theme",
412418 "virtualenv" => "dev-python/virtualenv",
413− "pip" => "dev-python/pip",
414419 "dot" => "media-gfx/graphviz",
415420 "convert" => "media-gfx/imagemagick",
416421 "xelatex" => "dev-texlive/texlive-xetex media-fonts/dejavu",
@@ -438,6 +443,18 @@ sub check_distros() · 21 unmodified lines
438443 give_redhat_hints;
439444 return;
440445 }
446+ if ($system_release =~ /CentOS/) {
447+ give_redhat_hints;
448+ return;
449+ }
450+ if ($system_release =~ /Scientific Linux/) {
451+ give_redhat_hints;
452+ return;
453+ }
454+ if ($system_release =~ /Oracle Linux Server/) {
455+ give_redhat_hints;
456+ return;
457+ }
441458 if ($system_release =~ /Fedora/) {
442459 give_redhat_hints;
443460 return;
@@ -488,9 +505,22 @@ sub check_distros() · 44 unmodified lines
488505 sub check_needs()
489506 {
490507 if ($system_release) {
491− print "Checking if the needed tools for $system_release are available\n";
508+ print "Detected OS: $system_release.\n";
492509 } else {
493− print "Checking if the needed tools are present\n";
510+ print "Unknown OS\n";
511+ }
512+
513+ # RHEL 7.x and clones have Sphinx version 1.1.x and incomplete texlive
514+ if (($system_release =~ /Red Hat Enterprise Linux/) ||
515+ ($system_release =~ /CentOS/) ||
516+ ($system_release =~ /Scientific Linux/) ||
517+ ($system_release =~ /Oracle Linux Server/)) {
518+ $virtualenv = 1;
519+ $pdf = 0;
520+
521+ printf("NOTE: On this distro, Sphinx and TexLive shipped versions are incompatible\n");
522+ printf("with doc build. So, use Sphinx via a Python virtual environment.\n\n");
523+ printf("This script can't install a TexLive version that would provide PDF.\n");
494524 }
495525
496526 # Check for needed programs/tools