On 7/13/05, Phillip J. Eby
At 03:00 PM 7/13/2005 +0100, Paul Moore wrote:
On 7/12/05, Paul Moore
wrote: Given a Distribution object (maybe derived from a user's command line, maybe from selection off a GUI) I can "uninstall" the Distribution by simply removing the egg (file or directory). Make sure you *only* do this to a directory if it has a '.egg' extension; otherwise you could delete a package installed using "develop"!
Hmm, I'm only looking on sys.path - I hadn't imagined that development software would be added to the *default* sys.path... But I take your point. Actually, as I'm only looking at these utilities from the POV of managing site-packages, maybe I should just strip out any entries from sys.path which aren't under that directory (although I don't know if I can find that directory on Unix - on Windows, it's under sys.(exec)prefix, but I don't know directory structures under Unix so well). I'll have to check the source of easy_install to see how it decides where to copy files *to* (in the absence of user overrides...) [... omitted some stuff about PthDistributions which I need to review ...]
3. Can eggs be in site-packages, but not locatable via find_distribution?
Um, only if you don't look for them. I'm not sure I understand the question.
Sorry - I'm doing find_distribution() on every entry in sys.path. What I was getting at, is whether that process could miss any eggs which easy_install may have put into site-packages. Again, the key point I forgot to clarify is that I want to keep track of "things that easy_install could have added to site-packages" - as I'm trying to add tools to do the operations easy_install doesn't supply (list, uninstall are the key ones) so that there's no requirement for the user to manually work inside site-packages.
I can't see anything in the Distribution API documentation, and I'm a little hazy on what happens in the face of multiple Distributions of the same package, all in site-packages at once but only one "installed".
You mean only one "activated" (they're all "installed"). What happens is that when you find_distributions('site-packages') they will all be listed. However, when you find_distributions() on the path entry that makes a particular one current, that one will show up again.
Ah, OK. That helps me understand the reason for the doubled entries mentioned above as well. Thanks, Paul.