Re: [Distutils] PEP 376 - site-directories and site.addsitedir
At 11:10 PM 5/14/2009 +0200, Tarek Ziadé wrote:
2009/5/14 P.J. Eby
: IOW, this approach keeps simple things simple, and leaves complex things possible. It also does less I/O than what you're proposing, since in the normal case the directories are only ever searched once, and the actual metadata reads are both lazy and cached.
Makes a lot of sense yes. I think I'll just start a prototype for that code, propose 376 on python-dev and see.
Notice, by the way, that this is a good example of pkg_resources' code only looking complex if you haven't gone through all the requirements and design issues yourself. The further you go with this, the more likely you're going to end up with something very much resembling pkg_resources itself. The bad news is that you'll be reinventing a lot of wheels. The good news is, you should also be able to understand and maintain pkg_resources internals by the time you're done. ;-) The relevant classes in pkg_resources, btw, are WorkingSet, Distribution, and EntryPoint. You might want to just copy them and strip out the parts you don't need. (i.e. sys.path manipulation and requirements-resolving stuff)
On Thu, May 14, 2009 at 11:27 PM, P.J. Eby
The relevant classes in pkg_resources, btw, are WorkingSet, Distribution, and EntryPoint. You might want to just copy them and strip out the parts you don't need. (i.e. sys.path manipulation and requirements-resolving stuff)
I tried to reuse it already, but I ended up removing lots of stuff and creating a simpler loop to scan sys.path elements, and work with the different sorts (zip dir, dir, etc) That's basically what I have done here: http://bitbucket.org/tarek/extensions/src/tip/extensions/reader.py) That happened because I got a bit lost in the way finders were working in setuptools, which seemed a bit over-engineered at that time to me (but I might end up changing my mind at sime point when I understand it better). Although, I think I understand why WorkingSet is required now. -- Tarek Ziadé | http://ziade.org
participants (2)
-
P.J. Eby
-
Tarek Ziadé