jerome.marant@free.fr (Jérôme Marant) in debian-python@lists.debian.org:
I am the python-unit maintainer (upstream program called PyUnit) for python 1.5 and 2.0. PyUnit has been included in Python 2.1. but I won't give it away since it does evolve separately from Python releases.
However, because of PYTHONPATH, the latest version of the module will never be loaded by the interpreter.
In 2.0 (and quite the same in 2.1), PYTHONPATH looks like:
amboise:~$ python2 -c 'import sys; print sys.path' ['', '/usr/lib/python2.0', '/usr/lib/python2.0/plat-linux2', '/usr/lib/python2.0/lib-dynload', '/usr/local/lib/python2.0/site-packages', '/usr/local/lib/site-python', '/usr/lib/python2.0/site-packages', '/usr/lib/site-python']
So, if the interpreter find the module in its core modules, it will never see that a newer version of the module was installed in site-packages.
Usually, packages installed separately (site-packages) from the core python modules are more recent that the same modules of the core, because they evolve faster than python releases. Manual installations of modules (/usr/local) are usually done when packages are not up-to-date, so more recent than site modules.
This is a well known problem since python-xml (PyXML) is both in 2.0 core and in a separate package and PyXML people have implemented an ugly hack to work this around.
So, I'm proposition to reorganize the PYTHONPATH like this :
['', '/usr/local/lib/python2.0/site-packages', '/usr/local/lib/site-python', '/usr/lib/site-python' '/usr/lib/python2.0/site-packages', '/usr/lib/python2.0', '/usr/lib/python2.0/plat-linux2', '/usr/lib/python2.0/lib-dynload',
]
I know that it could lead to some problems but not that much I think.
Thanks in advance for your comments.
PS: it would be usefull to talk to Brendan O'Dea who chose the same ordering for Perl packages.
Will this work? If so, why is it not already done? Neil
So, I'm proposition to reorganize the PYTHONPATH like this :
["site-packages first" proposal snipped] (Why do people write PYTHONPATH when they mean sys.path?)
Will this work? If so, why is it not already done?
I think it will work just fine. I suppose I was afraid that people would abuse this to override standard modules that will break other stuff in subtle ways, but they can do that anyway using the $PYTHONPATH environment variable. --Guido van Rossum (home page: http://www.python.org/~guido/)
However, because of PYTHONPATH, the latest version of the module will never be loaded by the interpreter.
Distutils has exactly the same problem (every module/package shipped int the standard python library has it). Here's an excerpt from the README: There's generally no need to install the Distutils under Python 1.6/2.0/2.1. However, if you'd like to upgrade the Distutils in your Python 1.6 installation, or if future Distutils releases get ahead of the Distutils included with Python, you might want to install a newer Distutils release into your Python installation's library. To do this, you'll need to hide the original Distutils package directory from Python, so it will find the version you install. For example, under a typical Unix installation, the "stock" Distutils directory is /usr/local/lib/python1.6/distutils; you could hide this from Python as follows: cd /usr/local/lib/python1.6 # or 2.0 mv distutils distutils-orig On Windows, the stock Distutils installation is "Lib\distutils" under the Python directory ("C:\Python" by default with Python 1.6a2 and later). Again, you should just rename this directory, eg. to "distutils-orig", so that Python won't find it. Once you have renamed the stock Distutils directory, you can install the Distutils as described above. Thomas
On 06 September 2001, Neil Schemenauer said:
Will this work? If so, why is it not already done?
Beats me. It's one of the things that bugged me when I was writing the Distutils, and I another thing I failed to convince Guido of at the time. Greg -- Greg Ward - Linux nerd gward@python.net http://starship.python.net/~gward/ Time flies like an arrow; fruit flies like a banana.
participants (4)
-
Greg Ward -
Guido van Rossum -
Neil Schemenauer -
Thomas Heller