Comment 0 for bug 821000

Revision history for this message
Zooko Wilcox-O'Hearn (zooko) wrote :

This is a long-standing issue in setuptools, which was copied into distribute when distribute forked. There exist patches the attempt to fix the issue offered against both setuptools and distribute. There are tickets in the setuptools issue tracker, distribute issue tracker, and the Tahoe-LAFS issue tracker (where we maintain a fork of setuptools in order to fix this among other outstanding bugs).

The crux of the problem is that the Python documentation says:

  "The PYTHONPATH variable can be set to a list of paths that will be added to the beginning of sys.path."

http://docs.python.org/install/index.html#modifying-python-s-search-path

This is true with standard distutils, false with setuptools, false with distribute, and true if you apply the following patch to either setuptools or distribute:

Index: setuptools/command/easy_install.py
===================================================================
--- setuptools/command/easy_install.py (revision 560)
+++ setuptools/command/easy_install.py (revision 562)
@@ -1365,5 +1365,5 @@
                 "import sys; new=sys.path[sys.__plen:];"
                 " del sys.path[sys.__plen:];"
- " p=getattr(sys,'__egginsert',0); sys.path[p:p]=new;"
+ " p=getattr(sys,'__egginsert',len(os.environ.get('PYTHONPATH','').split(os.pathsep))); sys.path[p:p]=new;"
                 " sys.__egginsert = p+len(new)\n"
             ) % data