Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp36325ybi; Wed, 29 May 2019 16:11:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqxHGd5FNPw6uxi60id+FR/CMutLCCTAn14qI9At13aYusyXGL7OLMn4GAasc0+xZWFHEbYM X-Received: by 2002:a17:902:5acb:: with SMTP id g11mr567459plm.198.1559171464226; Wed, 29 May 2019 16:11:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559171464; cv=none; d=google.com; s=arc-20160816; b=lpxzAitQQ9Cwzr0RN2Kon5Pi5csVdGeNW9s/7+0k63YYbWopDWYjSwBjfrgjSTBH1J GRNeBeaB1A6voEwvPpysIEB2BwLASlGO3g/WkCxqcyRm9X6lpffWhAlwKA+5SKW8fb0G A7qvKKVx+hdp8x5bBMk289yGcvJdUIlHauvMW6rv9n+zSf3aurWfQaAJtcgaaCC3L8Ug 5gEf3aDqRrGfdu+5tAqBqPnJgz+lEApMd+9HU5JuKsJ94hcivV5LPwxs3m2RmVBabbEs rpLkxLFJ2ftpkUlvoBjGZB59BiXXx2TaDT/xWWS3TJDhVa9SVa6eak+R1N6o7aab6g+M 9tCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xdMf4hb49NfuLIvwvlurkRXqs+h2lkzb21P6JrueUX8=; b=JxxkRWY7lVC0eyoAwPasNjPWphQUC5OpPubrqsYo1zuxQqNJxjR1INYx8caI5SxUDt 7nf4joLuCDtcHuo+emW9RBLbzrJV2ZrxjLPfqBuFs7OYK/LuhhkNgBzDuOY+pFstWEh1 1z1VsmUJFCR47M3G63gOM8/mCI52JcVJB8pUhA7ztYwIeg/t8H8/OONRqlM548EYgZEE iEq7wioxeuqoaqDfmseuVr3MA9VxrDgR9oqSwDgOxjqmEjyuHPljFrC325cPN9ifaR8M +9wRK0s8iJdKG90Y0JUUlgez2QC+9/pu5icgTaFjQ02wW9mJgcVXuA0wH0dwEdjfl9fT c1Kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=RmafWUK6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k1si1039419pll.317.2019.05.29.16.10.48; Wed, 29 May 2019 16:11:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=RmafWUK6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726759AbfE2XJk (ORCPT + 99 others); Wed, 29 May 2019 19:09:40 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:47596 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726483AbfE2XJh (ORCPT ); Wed, 29 May 2019 19:09:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=xdMf4hb49NfuLIvwvlurkRXqs+h2lkzb21P6JrueUX8=; b=RmafWUK6coqVpisPg0JiTm7cP5 yFpfgV3Zqpf3K/rk+6cVxdpxJXze/oxJhrPF8w9d81JSjdSgCb/nDJrmh0Xyq6K+JgJ9RDiGekm+l UPkmBQ6DNrI6EzE6hY9tV7WTPuftWggExOxib1cnc7SG0mdLXGn0k1tW2kaAGfecOQy63qiX30h6u iY8dMcWFm8eYsP9/yuwMrTNFoHEtxnq7wVOGbmtpnHrgqONq5zD0rWtgAVVZCsdPPvmlwVL4HcLs+ 5cWctPe08alhG9LyS4kyQtUxsWIw6PxgYteaK4BO1H975FedghjACq3Ok6Bv5UvZ2xIa++Vu1PKgA cEbwxJWg==; Received: from 177.132.232.81.dynamic.adsl.gvt.net.br ([177.132.232.81] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hW7hQ-0000lG-GM; Wed, 29 May 2019 23:09:36 +0000 Received: from mchehab by bombadil.infradead.org with local (Exim 4.92) (envelope-from ) id 1hW7hN-0007TN-IG; Wed, 29 May 2019 20:09:33 -0300 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 02/10] scripts/sphinx-pre-install: make activate hint smarter Date: Wed, 29 May 2019 20:09:24 -0300 Message-Id: <6126c0d83d8526afa930093c5cdeb49dedbd53d2.1559170790.git.mchehab+samsung@kernel.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It is possible that multiple Sphinx virtualenvs are installed on a given kernel tree. Change the logic to get the latest version of those, as this is probably what the user wants. Signed-off-by: Mauro Carvalho Chehab --- scripts/sphinx-pre-install | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install index 8c2d1bcf2e02..11239eb29695 100755 --- a/scripts/sphinx-pre-install +++ b/scripts/sphinx-pre-install @@ -1,7 +1,7 @@ #!/usr/bin/perl use strict; -# Copyright (c) 2017 Mauro Carvalho Chehab +# Copyright (c) 2017-2019 Mauro Carvalho Chehab # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -15,6 +15,7 @@ use strict; my $conf = "Documentation/conf.py"; my $requirement_file = "Documentation/sphinx/requirements.txt"; +my $virtenv_prefix = "sphinx_"; # # Static vars @@ -28,7 +29,8 @@ my $need_symlink = 0; my $need_sphinx = 0; my $rec_sphinx_upgrade = 0; my $install = ""; -my $virtenv_dir = "sphinx_"; +my $virtenv_dir = ""; +my $min_version; # # Command line arguments @@ -229,7 +231,6 @@ sub get_sphinx_fname() sub check_sphinx() { - my $min_version; my $rec_version; my $cur_version; @@ -255,7 +256,7 @@ sub check_sphinx() die "Can't get recommended sphinx version from $requirement_file" if (!$min_version); - $virtenv_dir .= $rec_version; + $virtenv_dir = $virtenv_prefix . $rec_version; my $sphinx = get_sphinx_fname(); return if ($sphinx eq ""); @@ -612,18 +613,23 @@ sub check_needs() which("sphinx-build-3"); } if ($need_sphinx || $rec_sphinx_upgrade) { - my $activate = "$virtenv_dir/bin/activate"; - if (-e "$ENV{'PWD'}/$activate") { + my $min_activate = "$ENV{'PWD'}/${virtenv_prefix}${min_version}/bin/activate"; + my @activates = glob "$ENV{'PWD'}/${virtenv_prefix}*/bin/activate"; + + @activates = sort {$b cmp $a} @activates; + + if (scalar @activates > 0 && $activates[0] ge $min_activate) { printf "\nNeed to activate virtualenv with:\n"; - printf "\t. $activate\n"; + printf "\t. $activates[0]\n"; } else { + my $rec_activate = "$virtenv_dir/bin/activate"; my $virtualenv = findprog("virtualenv-3"); $virtualenv = findprog("virtualenv-3.5") if (!$virtualenv); $virtualenv = findprog("virtualenv") if (!$virtualenv); $virtualenv = "virtualenv" if (!$virtualenv); printf "\t$virtualenv $virtenv_dir\n"; - printf "\t. $activate\n"; + printf "\t. $rec_activate\n"; printf "\tpip install -r $requirement_file\n"; $need++ if (!$rec_sphinx_upgrade); -- 2.21.0