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

shebang lines for Python scripts



So I know many of you are on python-dev, so you might have seen this come up,
but traffic there can be pretty heavy at times.

Upstream Python recommends that the shebang line for scripts should be

#!/usr/bin/env python

however, this should only apply to *developer* packages, not operating system
packages.  Doing the above in packages provided by the distro can cause those
scripts to break, if say a user installs their own Python sooner in $PATH, and
which is not compatible with the script.

It's also unnecessary for distros because we should know exactly which version
of Python our scripts work with.  And finally, setuptools will rewrite the
shebang line when it installs scripts (FSVO 'setuptools' ;).

There's about two such scripts in /usr/bin on my Squeeze machine.  Debian
policy should be clear that system installed Python scripts should have a
shebang line hardcoded to a Python executable.  Whether that should be
/usr/bin/python, /usr/bin/python2, /usr/bin/pythonX.Y or something else is a
different discussion. ;)  Personally /usr/bin/python seems fine to me for now.

-Barry

Attachment: signature.asc
Description: PGP signature


Reply to: