From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1g0fLw-00057H-Qc for mharc-grub-devel@gnu.org; Fri, 14 Sep 2018 00:05:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45803) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g0fLr-00056t-OD for grub-devel@gnu.org; Fri, 14 Sep 2018 00:05:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g0fLb-0002fr-US for grub-devel@gnu.org; Fri, 14 Sep 2018 00:04:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49952) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g0fLb-0002eX-JF for grub-devel@gnu.org; Fri, 14 Sep 2018 00:04:47 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DAF88C047B94; Fri, 14 Sep 2018 04:04:45 +0000 (UTC) Received: from mail.happyassassin.net (ovpn-116-152.phx2.redhat.com [10.3.116.152]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7B37A5DD74; Fri, 14 Sep 2018 04:04:45 +0000 (UTC) Message-ID: <8e507505ecb1e11641ab2e17d357cb305d9c94b8.camel@redhat.com> Authentication-Results: mail.happyassassin.net; dmarc=none (p=none dis=none) header.from=redhat.com Subject: Re: Patch: allow the 'python' used to run gentpl.py to be configured From: Adam Williamson To: The development of GNU GRUB , Daniel Kiper Date: Thu, 13 Sep 2018 21:04:44 -0700 In-Reply-To: <167358216f61c5136d6d6db4fa074f0d171683ae.camel@redhat.com> References: <20180706172545.GA14342@router-fw-old.local.net-space.pl> <167358216f61c5136d6d6db4fa074f0d171683ae.camel@redhat.com> Organization: Red Hat Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.0 (3.30.0-1.fc29) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 14 Sep 2018 04:04:46 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Sep 2018 04:05:07 -0000 On Tue, 2018-07-17 at 12:35 -0700, Adam Williamson wrote: > On Fri, 2018-07-06 at 13:19 -0700, Adam Williamson wrote: > > On Fri, 2018-07-06 at 19:25 +0200, Daniel Kiper wrote: > > > On Wed, Jul 04, 2018 at 10:08:53AM -0700, Adam Williamson wrote: > > > > gentpl.py is python2/3-agnostic, but there's no way to cause it > > > > to be run with any interpreter other than 'python', it's just > > > > hard-coded into Makefile.common that way. Adjust that to allow > > > > a make variable PYTHONBIN to be set to the desired interpreter. > > > > This will make it easier in situations where we specifically > > > > want to build with 'python2' or 'python3' or whatever. > > > > > > > > Signed-off-by: Adam Williamson > > > > > > Thanks for the patch. However, I think that the configure should find > > > correct python binary and set PYTHON variable (instead of PYTHONBIN) > > > in the Makefile (good example is BUILD_CC variable in Makefile.in). > > > > That's possible, but it depends what you mean by "correct", doesn't it? > > There could be many python interpreters installed on a system; which > > are we to assume is "correct"? > > > > We could make it configurable with some sort of default heuristic, I > > guess, I was just going for a simple patch approximately in line with > > what was done for autogen.sh for now. (And I wouldn't want to reinvent > > python interpreter discovery, which has been invented enough times > > already; if we were to go that route it'd probably make sense to use an > > existing autoconf extension or something). > > So I've just been looking into this, and it's actually very easy to do > using AM_PATH_PYTHON, provided by autoconf. However, there's a rather > funny wrinkle for grub's particular build process. AM_PATH_PYTHON has a > documented behaviour where, if the 'PYTHON' env var is set when > autoconf is run, it will *only* consider the value that env var is set > to as a candidate for the Python interpreter - it won't do its usual > attempt to discover one. And grub's autogen.sh already uses the PYTHON > env var - setting it if it was not set already - and then calls > autoreconf! > > So the practical effect of just applying this patch would be that only > 'python', or whatever the env var PYTHON is set to when running > autogen.sh, would be considered, when using autogen.sh. All the > 'discovery' bits of AM_PATH_PYTHON wouldn't be used: if you just call > 'autogen.sh' without setting PYTHON, but your Python binary is called > 'python3' or 'python2.7' or whatever, it won't work. > > This seems a bit funny, but I'm not sure if it's really a > *problem*...because autogen.sh *itself* will only work if whatever > value PYTHON is set to is a working Python interpreter, anyway. We > could in fact argue that the consequence is quite nice as it makes > everything sort of consistent: whatever PYTHON is set to will be the > interpreter used both by autogen.sh and for running gentpl.py. But I > figured I should point it out. > > With that in mind, I'm attaching the updated patch in git format. > Thanks! Ping? I never received any follow up to this. -- Adam Williamson Fedora QA Community Monkey IRC: adamw | Twitter: AdamW_Fedora | XMPP: adamw AT happyassassin . net http://www.happyassassin.net