[Python-Dev] Support the /usr/bin/python2 symlink upstream
Allan McRae
allan at archlinux.org
Wed Mar 2 00:57:59 CET 2011
On 02/03/11 08:06, Guido van Rossum wrote:
> On Tue, Mar 1, 2011 at 1:26 PM, Eric Smith<eric at trueblade.com> wrote:
>> On 3/1/2011 4:19 PM, Kerrick Staley wrote:
>>>
>>> Hello,
>>> There is a need for the default Python2 install to place a symlink at
>>> /usr/bin/python2 that points to /usr/bin/python, or for the
>>> documentation to recommend that packagers ensure that python2 is
>>> defined. Also, all documentation should be changed to recommend that
>>> "#!/usr/bin/env python2" be used as the shebang for Python 2 scripts.
>>> This is needed because some distributions (Arch Linux, in particular),
>>> point /usr/bin/python to /usr/bin/python3, while others (including
>>> Slackware, Debian, and the BSDs, probably more) do not even define the
>>> python2 command. This means that a script has no way of achieving
>>> cross-platform compatibility. The point at which many distributions
>>> begin to alias /usr/bin/python to /usr/bin/python3 is due soon, and for
>>> the next couple of years, it would be best to use a python2 or python3
>>> shebang in all scripts, making no assumptions about plain python, which
>>> should only be invoked interactively. This email from about 3 years ago
>>> seems relevant: :
>>> http://mail.python.org/pipermail/python-3000/2008-March/012421.html
>>> Again, this issue needs to be addressed by the Python developers
>>> themselves so that different *nix distributions will handle it
>>> consistently, allowing Python scripts to continue to be cross-platform.
>>>
>>
>> I believe we agreed at the language summit last year (or maybe even the year
>> before) that "python" would always be python2.x, and "python3" would be
>> python3.x.
>>
>> And by "always" we indeed meant forever. To do otherwise would break scripts
>> even many, many years from now.
>
> Unfortunately distros are not following these guidelines. As long as
> we still have the pythonX.Y links I think it's better to have
> "python2", "python3" and "python" than total anarchy.
>
This was brought up when Arch Linux switched /usr/bin/python to point a
python3 around six months ago, and at the time no-one could actually
recall the decision to always point /usr/bin/python at python2 forever.
In fact, the only decision that was clearly made (and acted on) was
that "make install" for python3 would install /usr/bin/python3.
e.g. http://www.mail-archive.com/python-dev@python.org/msg53204.html
But if that decision was made, it was not documented anywhere that I can
find, so effectively was a non-decision...
Deciding that /usr/bin/python going to always point at python2 just
makes me think that python3 is always going to be a second class
citizen. Eventually python-2.7 will be long gone and it would seem
wrong for people will still be using "python3" to run their scripts once
python-3.xx is the primary python version.
So a transition is going to need to be made here at some stage. Most
distributions have been providing the /usr/bin/python2 symlink for a
long time, with Debian being the notable exception. I think adding such
a symlink is in the realm of what distribution packagers can choose to
do on their own, but having it done automatically for python-2.7 would
also be of benefit.
Allan
More information about the Python-Dev
mailing list