History

scripts/sphinx-pre-install: allow checking for multiple missing files

The current implementation take a simple file as first argument, this change allows to take a list as a first argument. Some file could have a different path according distribution version

Jeremy MAURO committed 7 years ago

Commit ff8fdb31 parent bdd68861 file · +11 −9Browse files

Unified · Split

scripts/sphinx-pre-install+11−9
@@ -124,11 +124,13 @@ sub add_package($$) · 123 unmodified lines
124124
125125 sub check_missing_file($$$)
126126 {
127− my $file = shift;
127+ my $files = shift;
128128 my $package = shift;
129129 my $is_optional = shift;
130130
131− return if(-e $file);
131+ for (@$files) {
132+ return if(-e $_);
133+ }
132134
133135 add_package($package, $is_optional);
134136 }
@@ -343,10 +345,10 @@ sub give_debian_hints() · 208 unmodified lines
343345 );
344346
345347 if ($pdf) {
346− check_missing_file("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf",
348+ check_missing_file(["/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"],
347349 "fonts-dejavu", 2);
348350
349− check_missing_file("/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc",
351+ check_missing_file(["/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc"],
350352 "fonts-noto-cjk", 2);
351353 }
352354
@@ -413,7 +415,7 @@ sub give_redhat_hints() · 60 unmodified lines
413415 }
414416
415417 if ($pdf) {
416− check_missing_file("/usr/share/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc",
418+ check_missing_file(["/usr/share/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc"],
417419 "google-noto-sans-cjk-ttc-fonts", 2);
418420 }
419421
@@ -498,7 +500,7 @@ sub give_mageia_hints() · 78 unmodified lines
498500 $map{"latexmk"} = "texlive-collection-basic";
499501
500502 if ($pdf) {
501− check_missing_file("/usr/share/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc",
503+ check_missing_file(["/usr/share/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc"],
502504 "google-noto-sans-cjk-ttc-fonts", 2);
503505 }
504506
@@ -528,7 +530,7 @@ sub give_arch_linux_hints() · 23 unmodified lines
528530 check_pacman_missing(\@archlinux_tex_pkgs, 2) if ($pdf);
529531
530532 if ($pdf) {
531− check_missing_file("/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc",
533+ check_missing_file(["/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc"],
532534 "noto-fonts-cjk", 2);
533535 }
534536
@@ -549,11 +551,11 @@ sub give_gentoo_hints() · 14 unmodified lines
549551 "rsvg-convert" => "gnome-base/librsvg",
550552 );
551553
552− check_missing_file("/usr/share/fonts/dejavu/DejaVuSans.ttf",
554+ check_missing_file(["/usr/share/fonts/dejavu/DejaVuSans.ttf"],
553555 "media-fonts/dejavu", 2) if ($pdf);
554556
555557 if ($pdf) {
556− check_missing_file("/usr/share/fonts/noto-cjk/NotoSansCJKsc-Regular.otf",
558+ check_missing_file(["/usr/share/fonts/noto-cjk/NotoSansCJKsc-Regular.otf"],
557559 "media-fonts/noto-cjk", 2);
558560 }
559561