Gentoo Archives: gentoo-portage-dev

From: Sid Spry <sid@××××.us>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] Use env to find python
Date: Wed, 17 Jun 2020 04:10:53
Message-Id: 407e1897-bc1e-40ad-b3b6-958bc4fec325@www.fastmail.com
In Reply to: Re: [gentoo-portage-dev] [PATCH] Use env to find python by "Michał Górny"
1 On Tue, Jun 16, 2020, at 3:57 PM, Michał Górny wrote:
2 > On Tue, 2020-06-16 at 15:19 -0400, Mike Gilbert wrote:
3 > > On Tue, Jun 16, 2020 at 1:55 PM Zac Medico <zmedico@g.o> wrote:
4 > > > On 6/16/20 10:46 AM, Mike Gilbert wrote:
5 > > > > On Tue, Jun 16, 2020 at 1:45 PM Mike Gilbert <floppym@g.o> wrote:
6 > > > > > On Mon, Jun 15, 2020 at 9:39 AM Sid Spry <sid@××××.us> wrote:
7 > > > > > > On Mon, Jun 15, 2020, at 2:36 AM, Ulrich Mueller wrote:
8 > > > > > > > But we know that it is in /usr/bin, so why add yet another indirection?
9 > > > > > > >
10 > > > > > > > Attachments:
11 > > > > > > > * signature.asc
12 > > > > > >
13 > > > > > > Ah, sorry -- I forgot to note this here. If you wish to support prefix it is possible it may not be in /usr/bin. Granted I am not sure if the prefix stage3 I was using is old enough to be broken in some way, but adding this would prevent future breakage.
14 > > > > >
15 > > > > > The portage ebuild and the python distutils module already take care
16 > > > > > of updating shebangs at install time.
17 > > > >
18 > > > > I suppose your patch might be useful if you are trying to run portage
19 > > > > from a git checkout on a prefix system.
20 > > > >
21 > > >
22 > > > So, given that the ebuild updates shebangs automatically, should't we
23 > > > optimize the default shebangs to be as flexible as possible?
24 > >
25 > > Yes, that makes sense.
26 > >
27 > > However, we should test to make sure that distutils is smart enough to
28 > > parse that "/usr/bin/env -S python" string and replace it with
29 > > version-specific python shebang.
30 > >
31 >
32 > '/usr/bin/env python' (with no extra options) is the portable shebang.
33 >
34
35 I added `-S` to preserve the options passed via the shebang line. It seems they can be left off, does anyone know otherwise?

Replies

Subject Author
Re: [gentoo-portage-dev] [PATCH] Use env to find python Fabian Groffen <grobian@g.o>