Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751269AbdGPWIP (ORCPT ); Sun, 16 Jul 2017 18:08:15 -0400 Received: from ec2-52-27-115-49.us-west-2.compute.amazonaws.com ([52.27.115.49]:50728 "EHLO osg.samsung.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751124AbdGPWIN (ORCPT ); Sun, 16 Jul 2017 18:08:13 -0400 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" From: Mauro Carvalho Chehab To: Linux Doc Mailing List Cc: Mauro Carvalho Chehab , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, Jonathan Corbet Subject: [PATCH 2/5] sphinx-pre-install: detect an existing virtualenv Date: Sun, 16 Jul 2017 19:08:03 -0300 Message-Id: <76be7e90b442edc5768a221418a387869fe0db58.1500241961.git.mchehab@s-opensource.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1761 Lines: 55 Detect if the script runs after creating the virtualenv, printing the command line commands to enable the virtualenv. Signed-off-by: Mauro Carvalho Chehab --- 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