Phillip J. Eby wrote:
> At 01:55 PM 11/9/2005 +1000, Ashley Walsh wrote:
> 
>>Hi,
>>
>>Is there an easy way for a module to uses its __name__ to identify
>>the Distribution it comes from?  I had a look through pkg_resources
>>but I couldn't see a straight forward way to do it, so I thought I'd
>>ask.
>>
>>The reason is that I want a console script log its version.
> 
> 
> Well, if you know the *project* name, you can just do:
> 
>      pkg_resources.get_distribution("ProjectName").version

Incidentally, I use ('%s from %s' % (dist, dist.location)) for my 
version strings, as I find it useful to know where on disk it is coming 
from, in addition to what version.


-- 
Ian Bicking  /  [EMAIL PROTECTED]  /  http://blog.ianbicking.org
_______________________________________________
Distutils-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to