[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <7630983f35b7e61ff8b30aa5a016f64d26c8993a.1500327282.git.mchehab@s-opensource.com>
Date: Mon, 17 Jul 2017 18:46:37 -0300
From: Mauro Carvalho Chehab <mchehab@...pensource.com>
To: Linux Doc Mailing List <linux-doc@...r.kernel.org>
Cc: Mauro Carvalho Chehab <mchehab@...pensource.com>,
Mauro Carvalho Chehab <mchehab@...radead.org>,
linux-kernel@...r.kernel.org, Jonathan Corbet <corbet@....net>
Subject: [PATCH v2 3/8] 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@...pensource.com>
---
scripts/sphinx-pre-install | 26 +++++++++++++++++---------
1 file changed, 17 insertions(+), 9 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);
+ 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 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++;
+ 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";
--
2.13.3
Powered by blists - more mailing lists