mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 04:18:39 +08:00
scripts: sphinx-pre-install: provide both venv and package installs
As it is not a consensus about installing sphinx using venv, and modern distributions are now shipping with Sphinx versions above the minimal requirements to build the docs, provide both venv and package install commands by default. Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org> Link: https://lore.kernel.org/r/7c99d985df204c73e3daafd5fd2f30a31269405d.1656756450.git.mchehab@kernel.org Signed-off-by: Jonathan Corbet <corbet@lwn.net>
This commit is contained in:
parent
5b27d2551c
commit
6a5d7320fb
@ -25,6 +25,7 @@ my $need_sphinx = 0;
|
||||
my $need_pip = 0;
|
||||
my $need_virtualenv = 0;
|
||||
my $rec_sphinx_upgrade = 0;
|
||||
my $verbose_warn_install = 1;
|
||||
my $install = "";
|
||||
my $virtenv_dir = "";
|
||||
my $python_cmd = "";
|
||||
@ -103,10 +104,12 @@ sub check_missing(%)
|
||||
next;
|
||||
}
|
||||
|
||||
if ($is_optional) {
|
||||
print "Warning: better to also install \"$prog\".\n";
|
||||
} else {
|
||||
print "ERROR: please install \"$prog\", otherwise, build won't work.\n";
|
||||
if ($verbose_warn_install) {
|
||||
if ($is_optional) {
|
||||
print "Warning: better to also install \"$prog\".\n";
|
||||
} else {
|
||||
print "ERROR: please install \"$prog\", otherwise, build won't work.\n";
|
||||
}
|
||||
}
|
||||
if (defined($map{$prog})) {
|
||||
$install .= " " . $map{$prog};
|
||||
@ -386,7 +389,8 @@ sub give_debian_hints()
|
||||
check_missing(\%map);
|
||||
|
||||
return if (!$need && !$optional);
|
||||
printf("You should run:\n\n\tsudo apt-get install $install\n");
|
||||
printf("You should run:\n") if ($verbose_warn_install);
|
||||
printf("\n\tsudo apt-get install $install\n");
|
||||
}
|
||||
|
||||
sub give_redhat_hints()
|
||||
@ -458,10 +462,12 @@ sub give_redhat_hints()
|
||||
|
||||
if (!$old) {
|
||||
# dnf, for Fedora 18+
|
||||
printf("You should run:\n\n\tsudo dnf install -y $install\n");
|
||||
printf("You should run:\n") if ($verbose_warn_install);
|
||||
printf("\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");
|
||||
printf("You should run:\n") if ($verbose_warn_install);
|
||||
printf("\n\tsudo yum install -y $install\n");
|
||||
}
|
||||
}
|
||||
|
||||
@ -509,7 +515,8 @@ sub give_opensuse_hints()
|
||||
check_missing(\%map);
|
||||
|
||||
return if (!$need && !$optional);
|
||||
printf("You should run:\n\n\tsudo zypper install --no-recommends $install\n");
|
||||
printf("You should run:\n") if ($verbose_warn_install);
|
||||
printf("\n\tsudo zypper install --no-recommends $install\n");
|
||||
}
|
||||
|
||||
sub give_mageia_hints()
|
||||
@ -553,7 +560,8 @@ sub give_mageia_hints()
|
||||
check_missing(\%map);
|
||||
|
||||
return if (!$need && !$optional);
|
||||
printf("You should run:\n\n\tsudo $packager_cmd $install\n");
|
||||
printf("You should run:\n") if ($verbose_warn_install);
|
||||
printf("\n\tsudo $packager_cmd $install\n");
|
||||
}
|
||||
|
||||
sub give_arch_linux_hints()
|
||||
@ -583,7 +591,8 @@ sub give_arch_linux_hints()
|
||||
check_missing(\%map);
|
||||
|
||||
return if (!$need && !$optional);
|
||||
printf("You should run:\n\n\tsudo pacman -S $install\n");
|
||||
printf("You should run:\n") if ($verbose_warn_install);
|
||||
printf("\n\tsudo pacman -S $install\n");
|
||||
}
|
||||
|
||||
sub give_gentoo_hints()
|
||||
@ -610,7 +619,8 @@ sub give_gentoo_hints()
|
||||
|
||||
return if (!$need && !$optional);
|
||||
|
||||
printf("You should run:\n\n");
|
||||
printf("You should run:\n") if ($verbose_warn_install);
|
||||
printf("\n");
|
||||
|
||||
my $imagemagick = "media-gfx/imagemagick svg png";
|
||||
my $cairo = "media-gfx/graphviz cairo pdf";
|
||||
@ -700,7 +710,7 @@ sub check_distros()
|
||||
|
||||
sub deactivate_help()
|
||||
{
|
||||
printf "\nIf you want to exit the virtualenv, you can use:\n";
|
||||
printf "\n If you want to exit the virtualenv, you can use:\n";
|
||||
printf "\tdeactivate\n";
|
||||
}
|
||||
|
||||
@ -863,7 +873,7 @@ sub recommend_sphinx_version($)
|
||||
print "To upgrade Sphinx, use:\n\n";
|
||||
}
|
||||
} else {
|
||||
print "Sphinx needs to be installed either as a package or via pip/pypi with:\n";
|
||||
print "\nSphinx needs to be installed either:\n1) via pip/pypi with:\n\n";
|
||||
}
|
||||
|
||||
$python_cmd = find_python_no_venv();
|
||||
@ -873,6 +883,25 @@ sub recommend_sphinx_version($)
|
||||
printf "\t. $virtenv_dir/bin/activate\n";
|
||||
printf "\tpip install -r $requirement_file\n";
|
||||
deactivate_help();
|
||||
|
||||
printf "\n2) As a package with:\n";
|
||||
|
||||
my $old_need = $need;
|
||||
my $old_optional = $optional;
|
||||
%missing = ();
|
||||
$pdf = 0;
|
||||
$optional = 0;
|
||||
$install = "";
|
||||
$verbose_warn_install = 0;
|
||||
|
||||
add_package("python-sphinx", 0);
|
||||
check_python_module("sphinx_rtd_theme", 1);
|
||||
|
||||
check_distros();
|
||||
|
||||
$need = $old_need;
|
||||
$optional = $old_optional;
|
||||
|
||||
}
|
||||
|
||||
sub check_needs()
|
||||
|
Loading…
Reference in New Issue
Block a user