At 03:00 PM 7/13/2005 +0100, Paul Moore wrote:
>On 7/12/05, Paul Moore <[EMAIL PROTECTED]> 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"!
> However, according to the
>documentation, before I delete files for "the currently installed
>version of a package", I need to run easy_install -m <package> to
>ensure that Python doesn't continue to search for it. So, three
>questions:
>
>1. How can I tell from a Distribution instance if it is "the currently
>installed version"?
If its .path attribute matches an entry in sys.path. But you'd probably be
better off manipulating easy-install.pth directly, via PthDistributions.
>2. How can I do the equivalent of easy_install -m in code?
There's a PthDistributions class in setuptools.command.easy_install; look
at it and the code that uses it. Unfortunately, this code is targeted for
refactoring when pkg_resources gets refactored, but hopefully its API won't
change much.
>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.
>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.
_______________________________________________
Distutils-SIG maillist - [email protected]
http://mail.python.org/mailman/listinfo/distutils-sig