[Python-Dev] Support the /usr/bin/python2 symlink upstream

Barry Warsaw barry at python.org
Fri Mar 4 03:11:40 CET 2011


On Mar 03, 2011, at 02:17 PM, David Malcolm wrote:

>On a related note, we have a number of scripts packaged across the
>distributions with a shebang line that reads:
>   #!/usr/bin/env python
>which AIUI follows upstream recommendations.

Actually, I think this is *not* a good idea for distro provided scripts.  For
any Python scripts released by the distro, you know exactly which Python it
should run on, so it's better to hard code it.  That way, if someone installs
Python from source, or installs an experimental version of a new distro
Python, it won't break their system.  Yes, this has happened to me.  Also,
note that distutils/setuptools/distribute rewrite the shebang line when they
install scripts.

>There was a proposal to change these when packaging them to hardcode the
>specific python binary:
>
>https://fedoraproject.org/wiki/Features/SystemPythonExecutablesUseSystemPython
>on the grounds that a packaged system script is expecting (and has been
>tested against) a specific python build.
>
>That proposal has not yet been carried out.  Ideally if we did this,
>we'd implement it as a postprocessing phase within "rpmbuild", rather
>than manually patching hundreds of files.
>
>Note that this would only cover shebang lines at the tops of scripts.

JFDI!

FWIW, a quick grep reveals about two dozen such scripts in /usr/bin on
Ubuntu.  We should fix these. ;)

-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-dev/attachments/20110303/920014c5/attachment.pgp>


More information about the Python-Dev mailing list