[Distutils] EasyInstall: List of installed packages
Phillip J. Eby
pje at telecommunity.com
Sun Jun 5 23:35:39 CEST 2005
At 09:55 PM 6/5/2005 +0100, Paul Moore wrote:
>On 6/5/05, Phillip J. Eby <pje at telecommunity.com> wrote:
> > At 04:40 PM 6/5/2005 +0100, Paul Moore wrote:
> > >Is there a way of asking EasyInstall "what packages are installed"?
> >
> > Not the command-line script. However "ls site-packages/*.egg" or "dir
> > site-packages\*.egg" depending on your platform will give you the answer.
>[...]
> > Ah, I see the confusion. Yes, there's a "registry" of packages installed
> > by EasyInstall. They're eggs, so they're in directories or files named for
> > the distribution, version, python version, and platform. So the
> > installation *itself* is the registry, and therefore can't be corrupted or
> > out of date.
>
>I see. On the other hand, there's this .pth file containing the egg
>name, so you can't just add & remove egg files, you do need to go
>through the EasyInstall interface or things get mixed up.
Not really; invalid entries in .pth do nothing but maybe slow down some
imports. EasyInstall isn't confused by them at all, and will remove them
the next time you do an install operation involving a distribution with the
same name.
> So there is
>some (relatively minor) level at which things are more "managed" than
>just file copies.
Extremely minor. :) Note that the .pth is not a registry; the egg files
and directories themselves are the registry, so it's a very robust approach.
>And of course, egg files with non-standard names are
>"not in the registry" to some extent.
Well, you can always look at EGG-INFO/PKG-INFO. The egg runtime system
only does this under very limited circumstances, for performance
reasons. So you could create a tool that would verify eggs' name and
version from PKG-INFO.
More information about the Distutils-SIG
mailing list