Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp1620919ybm; Thu, 23 May 2019 04:15:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqwXtdibx6D4ug/CWCYdJrjYm5q2TFdYWSwgCRfudkUisTWJiyGqCcohzfhHEQdju9RHygoN X-Received: by 2002:a17:902:9a4c:: with SMTP id x12mr26589798plv.298.1558610134504; Thu, 23 May 2019 04:15:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558610134; cv=none; d=google.com; s=arc-20160816; b=X71JhK6eQpClJLl1tEstXYr96PtWL4YPfGSiXPDpmx9FCG+PT2NWZ7W+PtoVCUGwIg YXxRnlDLRq/OtfuSkoGBCRDnO8NLjoIw4/hAg1uznRP6dxp8rL0YYHOaebJi7gNf0t+D sa57DZv5kNLYnENsymyMNF0nWEahG0106gbhRNQYA5UeFq5uTR7SeuNMNrTpBvjQIFzy VIRSYOBiliCIlbDa9q6EddXoOKg0mew6oiGrgumSYGLp1awkGC5ntS5jZRd+gkqoVFMU oF7I+i5SE27czs/6EtCuTUxUL639nWrBlt0LTWAyGlPhRFAfCdW3rV/VgaFDwrDWgUqG FYsw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=xdMf4hb49NfuLIvwvlurkRXqs+h2lkzb21P6JrueUX8=; b=DBHYvFRCnq4ZWbTQq31xo78XISuDvi/LA6ZS3hRS4GM1zmol6gmb/eL4WSL+IMlZeq DBpXBWV3CJICemuXNHccLEa/ZCd4AnRk0DxT9jq6OjyLJIAkkKa4z7XSesk4bYFNyNT3 4yGtQotwH/u0UUBYCOL2ExbeVP1lq3ZLQQ7WBYWYb4OGPfuRFV8XmoE8Lm3mbGEhu+08 ID4xf6UyEg9Wyyx7dyWQq5wagGTaLilk8cBlXnePJ1L1c+Q9+IMtllLrgLdCPs8sgpiT 0XJyoAHqsl01NBhrkAfOkNkJqwXS/yRmlUV3SAbCuzc3+nHQNhHeFV31pPoAz7FZ9X/Y Siug== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="E4mKAz/w"; 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 u9si31352178pgq.44.2019.05.23.04.15.16; Thu, 23 May 2019 04:15:34 -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="E4mKAz/w"; 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 S1730323AbfEWLOH (ORCPT + 99 others); Thu, 23 May 2019 07:14:07 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:40390 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727466AbfEWLOG (ORCPT ); Thu, 23 May 2019 07:14:06 -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: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:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=xdMf4hb49NfuLIvwvlurkRXqs+h2lkzb21P6JrueUX8=; b=E4mKAz/wlARBwiBzcJxiim61Q Lp1euNrhQBlqijcFzYYwbc2Cqc1rje7VHGEZ0gQ1fi+I4KgzBaEYMuzbnwPzQEiJHBTUKBvAQm+Z/ 25mtkbUt4x13xnlXDWm4/eHutOD0W3xme0bS4w4uUnXNfGu6f7uHLEhlO5wr7aZfzW4MMXPlsdnqj /2AmY7FNkwq7f+XWWTGy7PT7/RHezDP84nboNRprgCtG2gzjoFndlcWlA3QaZg4PDHhJVPGEK+zuB iwQuzO4NpGMXQ4wtkjyD5ecDsr1gcxNBHAuLvQtYZcipgSBmp4GJ8mXGFeGO07ieskLdjVKpFraQn mGOyiuiJg==; Received: from [179.182.168.126] (helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hTlfi-0000m0-CT; Thu, 23 May 2019 11:14:06 +0000 Received: from mchehab by bombadil.infradead.org with local (Exim 4.92) (envelope-from ) id 1hTlff-0007NY-PR; Thu, 23 May 2019 08:14:03 -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] scripts/sphinx-pre-install: make activate hint smarter Date: Thu, 23 May 2019 08:14:02 -0300 Message-Id: <582e6b7351f619d92035db8cfe24ecec5d95a489.1558610037.git.mchehab+samsung@kernel.org> X-Mailer: git-send-email 2.21.0 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