Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#31179 - #!/usr/bin/python configurable to either python2 or python3 with environment variable

Attached to Project: Arch Linux
Opened by Ben Booth (benwbooth) - Friday, 17 August 2012, 23:13 GMT
Last edited by Allan McRae (Allan) - Friday, 17 August 2012, 23:57 GMT
Task Type Feature Request
Category Packages: Extra
Status Closed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 8
Private No

Details

A lot of python scripts still use #!/usr/bin/python instead of specifying python2 or python3. I created a quick bash script to replace the python symlink in /usr/bin/python that allows you to use an environment variable PYTHON to indicate whether python refers to python2 or python3:

#!/usr/bin/env bash
test "$PYTHON" != "python2" -a "$PYTHON" != "python3" && unset PYTHON
exec /usr/bin/"${PYTHON:-python3}" "$@"

Then to use it, just export PYTHON=python2 or python3, then run your scripts. The setting will remain in effect until you exit the session.

A script like this would be useful for choosing which version of python should be run for these kinds of ambiguous scripts. It's better than simply pointing the /usr/bin/python symlink to either python version because the setting only takes effect for that particular login session instead of for the whole system. The only problem that I can see with it is that /usr/bin/python is owned by the python package and will be overwritten when the python package is updated.

So I guess what I'm asking is, any chance this script could replace the /usr/bin/python symlink in the python package?

Thanks!
This task depends upon

Closed by  Allan McRae (Allan)
Friday, 17 August 2012, 23:57 GMT
Reason for closing:  Won't implement
Additional comments about closing:  Fix the scripts

Loading...