Folks:

There are two things that cause a lot of people to object to the use
of setuptools: that it changes the semantics of PYTHONPATH, making it
impossible to override packages on the command-line, and that it
doesn't work when you run "setup.py install --prefix=./some_dir".

This patch addresses the first one. Currently, if you ever allow
setuptools to write into your system directory
(e.g. /usr/lib/python2.5/site-packages) then it will install a .pth
file which changes the behavior of PYTHONPATH.

This will prevent you from over-riding the installed package with a
specific package on the command-line, such as:

PYTHONPATH=./that-version-of-Twisted/ python ./my_script.py

Many people find this behavior of setuptools objectionable [1, 2, 3,
plus personal correspondance when I did my "Why do you hate
setuptools?" survey].  Fortunately it seems possible to preserve the
precedence of PYTHONPATH modules while still having installed eggs
override installed non-eggs, as motivated in [4].

Sat Nov 15 11:59:32 MST 2008  [EMAIL PROTECTED]
  * leave the PYTHONPATH dirs at the front of the sys.path
  This is in accordance with
  http://www.python.org/doc/2.5.2/inst/search-path.html , which says
  "The PYTHONPATH variable can be set to a list of paths that will be
  added to the beginning of sys.path.", and it resolves an objection
  many people have which impels them to ban setuptools from systems
  they administrate.
--- old-dw-0.6c9/setuptools/command/easy_install.py
+++ new-dw-0.6c9/setuptools/command/easy_install.py
@@ -1364,7 +1364,7 @@
                 "%s\n"
                 "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



Regards,

Zooko
---
http://allmydata.org -- Tahoe, the Least-Authority Filesystem
http://allmydata.com -- back up all your files for $10/month

[1] http://mail.python.org/pipermail/distutils-sig/2006-July/006492.html
[2] https://www.dfwpython.org/pipermail/dfwpython/2007-June/000756.html
[3] http://www.rittau.org/blog/20070726-02
[4] http://mail.python.org/pipermail/python-dev/2008-March/077918.html

Sat Nov 15 11:59:32 MST 2008  [EMAIL PROTECTED]
  * leave the PYTHONPATH dirs at the front of the sys.path
  This is in accordance with 
  http://www.python.org/doc/2.5.2/inst/search-path.html , which says "The 
  PYTHONPATH variable can be set to a list of paths that will be added to 
  the beginning of sys.path.", and it resolves an objection many people 
  have which impels them to ban setuptools from systems they administrate.
  
diff -rN -u old-dw-0.6c9+zookopatches/setuptools/command/easy_install.py 
new-dw-0.6c9+zookopatches/setuptools/command/easy_install.py
--- old-dw-0.6c9+zookopatches/setuptools/command/easy_install.py        
2008-11-15 12:40:13.000000000 -0700
+++ new-dw-0.6c9+zookopatches/setuptools/command/easy_install.py        
2008-11-15 12:40:14.000000000 -0700
@@ -1364,7 +1364,7 @@
                 "%s\n"
                 "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
 

_______________________________________________
Distutils-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to