bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Change the python interpretor to use /usr/bin/env python3


From: Bernhard Voelker
Subject: Re: Change the python interpretor to use /usr/bin/env python3
Date: Mon, 2 Apr 2018 11:31:26 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

On 04/02/2018 10:02 AM, Darshit Shah wrote:
> As you can see here, only Python 3 is installed in the base system. However,
> contrary to expectations, python3 does not provide /usr/bin/python. That 
> binary
> is provided by the `python2` package on Fedora. Since python2 is not installed
> by default in the docker container, this means that only the 
> "/usr/bin/python3"
> binary is available on that system.
> 
> However, I was mistaken about the call to `#!/usr/bin/env python` working. 
> Only
> `#!/usr/bin/env python3` works. Since Python 3 is the version that is being
> specifically targeted, could we please change it to reflect that? As far as 
> I'm
> aware, all systems with Python 3 installed always have a python3 binary
> available in $PATH. However, a /usr/bin/python may point to python 2 or 3.

FWIW there are discussions [1] in the opposite direction, i.e., to avoid
/usr/bin/env in the shebang where possible.  E.g. in openSUSE there is a
check for RPM builds which leads to:

  pyrenamer.noarch: E: env-script-interpreter (Badness: 9) /usr/bin/pyrenamer 
/usr/bin/env python
  This script uses 'env' as an interpreter. For the rpm runtime dependency
  detection to work, the shebang #!/usr/bin/env python  needs to be patched into
  #!/usr/bin/python  otherwise the package dependency generator merely adds a
  dependency on /usr/bin/env rather than the actual interpreter /usr/bin/python.
  Alternatively, if the file should not be executed, then ensure that it is not
  marked as executable or don't install it in a path that is reserved for
  executables.

[1]
https://lists.opensuse.org/opensuse-packaging/2018-03/msg00017.html

Have a nice day,
Berny

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]