[Distutils] Shebang lines, /usr/bin/python, and PEP394
alexjeffburke at gmail.com
Fri Jul 26 13:31:54 CEST 2013
On 26 July 2013 00:37, Philip Jenvey <pjenvey at underboss.org> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA512
> On Jul 25, 2013, at 9:04 AM, Toshio Kuratomi wrote:
>> Over on python-dev we're talking about Linux Distributions switching from
>> python2 to python3, what steps they need to take and in what order. One of
>> the things that's come up _ is that a very early step in the process is making
>> sure that shebang lines use /usr/bin/python2 or /usr/bin/python3 as noted in
>> PEP394 _. Faced with the prospect of patching a whole bunch of scripts
>> in the distribution, I'm wondering what distutils, distlib, setuptools, etc
>> do with shebang lines.
>> * Do they rewrite shebang lines?
> distutils, distlib and setuptools all do.
It was interesting that discussion came up on python-dev but I admit
to being surprised by the suggestion the shebang lines may need to be
rewritten in end user code.
This may be a callous over-simplification but if #!python is rewritten
by the python packaging infrastructure, would it not be changed for
python2/python3 as appropriate at installation time? Thus a python 2
package (whatever it is named) would be generated by calling a python2
executable + setuptools while the same is true for v3 except using
python3. The result is then packaged by rpm/dpkg.
Keen to understand why it can't work this way if that's the case.
Thanks, Alex J Burke.
More information about the Distutils-SIG