Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3675366ybi; Mon, 27 May 2019 04:10:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqzqp6PbSZjMMFTkAwqYqdz0DM0jJo5hYEXKQRLtT4PoIc5fMg2qBHBYgRYqaiewohvflUV9 X-Received: by 2002:a17:90a:2109:: with SMTP id a9mr31082693pje.2.1558955424554; Mon, 27 May 2019 04:10:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558955424; cv=none; d=google.com; s=arc-20160816; b=TAETXLq4z9ByBPtSILXuWFrLrovf2eABGlsIJ3RLnTWwatsCyMs6lY1fNVfbTd9dhG qlU/qjalQUINhFzLeFxTsc276LhxeJOc7akwpi7KWVlOTSRxLfBUut1L/+/B8unVqjyk OG9ZI7oZIGvrFbkyWT+DbyM4duu/1GzWwK6zZO81ROYEQUWN7hD54WJiZk9cAphBAy3X Ebi40fHmo9RPRishM0Fzi3PqXyBw62G6/bLrjoY0WnpveyUArU+HJQrtXY9bHywIYCxA hFI3xRa7n5qJ70hLLwMnqJR2/hMKjENHNxdM3fE5tSXj97axETz7m7JzA70IhWZ4nGlm R0ug== 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=GOnPCrob8ztZ9/Ncqw/CD03lYFvr9z2vJx50rwyxqnKxnb51va44dU5UOYD64zSVoH rKAhFfN6lR1kWJXsTIZ3zv6oa0BeFhf3TEdbPp3amz73yXTrzh2wufOjrptKLdHQukeo OPgcJlUwpyjAJdK5jZeTiKEDpWUFdG2W0cWuBkU9DGZppGg0FAHmW0Ir0dtfVJSfCoB0 oallxHdA1ztM5twUwATCBJKJYyG2PDHvvCdUYkIN9FnCJfwYDLXs9y6R08YJ7qNGBtxF +Ejwwxpcozjuqh9FrHnty4IRL5j5Yduu9PcSOS0Wo4oEUzGvpOFTHf20ta3pFstEST9K Xalg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=MvkLq4HK; 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 m63si18114085pld.421.2019.05.27.04.10.08; Mon, 27 May 2019 04:10:24 -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=MvkLq4HK; 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 S1726522AbfE0LHu (ORCPT + 99 others); Mon, 27 May 2019 07:07:50 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:57832 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726394AbfE0LHs (ORCPT ); Mon, 27 May 2019 07:07:48 -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=MvkLq4HK0NZn0e2/h4yznGPgQj y9+LyYRxcxpijHD5uABgj7zzrZ+5DhZlv1GVZsk5oyoQh/ieOYRuRwDhFvJ8sL09BO9DrtwGL4S2j 2T8NWgUB6M8OLFJC1nAUsXrE4OVzTKCr6XQaWqZXUuH1OFGpS+K+TIlVJ48RqtdEKp1lRdYO7d3tN qnF5xlaHzIa/oH9hzjGJl02xSIKr1GQKo/GeWgmyEr/tZK0FcH7O/B3x13FAhtx0b+NpLo+5rsu1j qmnRwp46WJjgdv6Njr+LaWtyW+0GbwdXHjk86j0xgJMuUReuU/YNo+dA+WFEp14inEwlLA/2Bnazq iEX4xxhA==; Received: from [177.159.249.4] (helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hVDTn-00061u-OV; Mon, 27 May 2019 11:07:47 +0000 Received: from mchehab by bombadil.infradead.org with local (Exim 4.92) (envelope-from ) id 1hVDTi-0002ce-Nz; Mon, 27 May 2019 08:07:42 -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 1/5] scripts/sphinx-pre-install: make activate hint smarter Date: Mon, 27 May 2019 08:07:37 -0300 Message-Id: <50d92e30af2b040ea3c538c7462219cefd9328ae.1558955082.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