Commit 5be33182 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab Committed by Jonathan Corbet

sphinx-pre-install: detect an existing virtualenv

Detect if the script runs after creating the virtualenv,
printing the command line commands to enable the virtualenv.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
parent 24071ac1
...@@ -13,6 +13,8 @@ use strict; ...@@ -13,6 +13,8 @@ use strict;
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
my $virtenv_dir = "sphinx_1.4";
# #
# Static vars # Static vars
# #
...@@ -454,17 +456,23 @@ sub check_needs() ...@@ -454,17 +456,23 @@ sub check_needs()
which("sphinx-build-3"); which("sphinx-build-3");
} }
if ($need_sphinx) { if ($need_sphinx) {
my $activate = "$virtenv_dir/bin/activate";
if (-e "$ENV{'PWD'}/$activate") {
printf "\nNeed to activate virtualenv with:\n";
printf "\t. $activate\n";
} else {
my $virtualenv = findprog("virtualenv-3"); my $virtualenv = findprog("virtualenv-3");
$virtualenv = findprog("virtualenv") if (!$virtualenv); $virtualenv = findprog("virtualenv") if (!$virtualenv);
$virtualenv = "virtualenv" if (!$virtualenv); $virtualenv = "virtualenv" if (!$virtualenv);
printf "\t$virtualenv sphinx_1.4\n"; printf "\t$virtualenv $virtenv_dir\n";
printf "\t. sphinx_1.4/bin/activate\n"; printf "\t. $activate\n";
printf "\tpip install 'docutils==0.12'\n"; printf "\tpip install 'docutils==0.12'\n";
printf "\tpip install 'Sphinx==1.4.9'\n"; printf "\tpip install 'Sphinx==1.4.9'\n";
printf "\tpip install sphinx_rtd_theme\n"; printf "\tpip install sphinx_rtd_theme\n";
$need++; $need++;
} }
}
printf "\n"; printf "\n";
print "All optional dependenties are met.\n" if (!$optional); print "All optional dependenties are met.\n" if (!$optional);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment