[Distutils] finding my own version with setuptools
Ian Bicking
ianb at colorstudy.com
Wed Nov 9 17:29:44 CET 2005
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 / ianb at colorstudy.com / http://blog.ianbicking.org
More information about the Distutils-SIG
mailing list