[Distutils] patch: solving the two major things that people dislike about setuptools, part 1
zooko at zooko.com
Sat Nov 15 20:42:05 CET 2008
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 .
Sat Nov 15 11:59:32 MST 2008 zooko at zooko.com
* 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
@@ -1364,7 +1364,7 @@
"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
" sys.__egginsert = p+len(new)\n"
) % data
http://allmydata.org -- Tahoe, the Least-Authority Filesystem
http://allmydata.com -- back up all your files for $10/month
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the Distutils-SIG