At 01:47 PM 7/4/2005 -0400, Ryan Tomayko wrote:
On Jul 4, 2005, at 12:45 PM, Phillip J. Eby wrote:
It does allow version specification at runtime; in fact there are already hooks that can be used to make require() automatically run easy_install, and these hooks are in fact already used to install packages' declared dependencies.
However, these hooks have to be explicitly activated; simply building this capability into Python's default behavior would be an extreme security risk.
What's the best way to turn that on? I haven't seen it referenced in the doc anywhere. I have a case where that would be useful.
Create an instance of AvailableDistributions or a subclass thereof, either overriding the 'obtain()' method, or passing in an 'installer' argument to resolve(). EasyInstall does this in its 'process_distribution()' method, for example. This API is going to change in 0.6 though, when I refactor to match the new spec. In the new spec, 'resolve()' will be an operation on a WorkingSet, which will be allowed to search various sources (e.g. collections of distributions) for possible resolutions. This will make more sense, IMO, than asking a collection to resolve a requirement in terms of a working set. Indeed, the awkwardness of that very mechanism was one of the things that made me realize the architecture needed refactoring.