summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@s-opensource.com>2017-07-18 00:46:37 +0300
committerJonathan Corbet <corbet@lwn.net>2017-07-24 00:51:10 +0300
commit5be33182d4e22750237281f03172e6c3456cdb42 (patch)
tree60c007248d9a9882b3535ca13868393157e37585 /scripts
parent24071ac1a6176dda89b441cc4c757c51e2f523e0 (diff)
downloadlinux-5be33182d4e22750237281f03172e6c3456cdb42.tar.xz
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: Mauro Carvalho Chehab <mchehab@s-opensource.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/sphinx-pre-install28
1 files changed, 18 insertions, 10 deletions
diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install
index 5fe3b4a86174..bcd6f7978f8d 100755
--- a/scripts/sphinx-pre-install
+++ b/scripts/sphinx-pre-install
@@ -13,6 +13,8 @@ use strict;
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
+my $virtenv_dir = "sphinx_1.4";
+
#
# Static vars
#
@@ -454,16 +456,22 @@ sub check_needs()
which("sphinx-build-3");
}
if ($need_sphinx) {
- my $virtualenv = findprog("virtualenv-3");
- $virtualenv = findprog("virtualenv") if (!$virtualenv);
- $virtualenv = "virtualenv" if (!$virtualenv);
-
- printf "\t$virtualenv sphinx_1.4\n";
- printf "\t. sphinx_1.4/bin/activate\n";
- printf "\tpip install 'docutils==0.12'\n";
- printf "\tpip install 'Sphinx==1.4.9'\n";
- printf "\tpip install sphinx_rtd_theme\n";
- $need++;
+ 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");
+ $virtualenv = findprog("virtualenv") if (!$virtualenv);
+ $virtualenv = "virtualenv" if (!$virtualenv);
+
+ printf "\t$virtualenv $virtenv_dir\n";
+ printf "\t. $activate\n";
+ printf "\tpip install 'docutils==0.12'\n";
+ printf "\tpip install 'Sphinx==1.4.9'\n";
+ printf "\tpip install sphinx_rtd_theme\n";
+ $need++;
+ }
}
printf "\n";