
At 09:07 PM 4/11/2008 -0700, Cliff Wells wrote:
Hi Phillip,
I recently upgraded a hosting server from Python 2.4 to Python 2.5. Many of the sites on this server couldn't easily be upgraded to 2.5 (at least not in a timely fashion), so my interim solution was to simply symlink ~/bin/python -> /usr/bin/python2.4 (~/bin is first in the user's PATH). This worked swimmingly except for applications which relied on Paste (I should note I use the method outlined here: http://peak.telecommunity.com/DevCenter/EasyInstall#administrator-installati...).
The reason the Paste apps had an issue is because apparently setuptools modifies the shebang line of paster to be "#!/usr/bin/python". This hardcoded path overrides any PATH settings. I understand that this is done at the time Paste is installed to tie it to the installed version of Python. This makes sense, except that it doesn't do what it's intended to when Python is upgraded (/usr/bin/python is no longer the version it was installed with).
It seems the correct solution to this is to use "#!/usr/bin/env python" (or rather, evaluate `which env` to account for some systems which have /bin/env rather that /usr/bin/env) which allows the sys admin to override the Python binary much more easily.
No, it isn't the correct solution. The correct solution is to re-run easy_install on the target -- it will leave the existing installed code in place, but regenerate the scripts with headers pointing to the currently-in-use Python. Even that is often not as good an idea as reinstalling for a new version of Python; some packages (notably, setuptools itself, but I have others) include different code and data depending on the Python version they are built for. For example, a package built for Python 2.5 might not include dependency specs for ctypes, sqlite, or wsgiref, but the same package might need to specify those dependencies on earlier versions of Python. By the way, please don't send me unsolicited private emails about setuptools unless you're a client or potential client. There's a reason that every single official web page about setuptools directs you to email the distutils-sig. I don't do private email for ANY of my open source projects, unless you're a client or looking to be one. Mailing lists have searchable archives, meaning that my time answering a question is being offset by its potential utility to a much larger audience. Thanks.