[Distutils] Finding only activated eggs in Environment()

Rob Cakebread pythonhead at gentoo.org
Tue Nov 22 09:10:14 CET 2005


Phillip J. Eby wrote:
> At 05:27 PM 11/21/2005 -0800, Rob Cakebread wrote:
> 
>> I'm using pkg_resources.Environment() to get a list of all
>> eggs.
>>
>> Besides making a list of activated eggs with
>> pkg_resources.working_set
>> and comparing it with pkg_resources.Environment, is there
>> a way to check if an individual egg is activated?
> 
> 
> if someDist in working_set:
>    # a distribution w/same location/version/pyversion/etc.
>    # is in there
> 
> Note that distribution objects are "value" objects in the sense that you 
> can have dist1==dist2 be true, and dist1 is dist2 be false.  So, even if 
> the 'dist' object came from a different source, the 'in' test will still 
> return True if the dist refers to the same 
> location/version/pyversion/platform/etc.
> 
> 

Thanks, thats what I needed. I've been working on "yolk"[1] again and
fixed it so it lists all versions of an egg, not just the latest.
(moved from the Peak mailing list)

If anyone is interested, I started a utility to list all eggs, only
activated eggs, or only non-activated eggs with some of the
metadata (version, desc, license etc.)

I just added a -d option so you can list dependencies of an egg.
I'm working on making it show what version of each dependency
is actually installed.

[1] http://eggs.gentooexperimental.org/file/trunk/tools/yolk.py



More information about the Distutils-SIG mailing list