[Distutils] Way to ask distutils what version of a package is installed?

Tarek Ziadé ziade.tarek at gmail.com
Sat Jan 10 11:20:59 CET 2009


On Fri, Jan 9, 2009 at 11:08 PM, ray terrill <rayjohnterrill at gmail.com> wrote:
> Is there a way to ask distutils what version of a package is currently
> installed?  I provided the version number when creating my setup.py, but
> when this is deployed over 800+ clients, I'd like to have a way to
> interrogate the system to determine which version is installed.
>

Unfortunately not by code, or not in an universal way I know of..

Distutils creates an YOUR-PACKAGE-VERSION.egg-info file in your
package-includes folder, that contains the information.

If you use setuptools though, it might be located in
YOUR-PACKAGE-VERSION.egg/EGG-INFO/PKG-INFO

Imho, I think the best way to get the version of your packages would
be to maintain a __version__ string in your package
to be able to query it from the code.

That said, it would make sense to include in Distutils an API that
would let people browse by the Metadata of the *.egg-info
files for installed packages.

Regards
Tarek

> Thanks,
> -Ray
>
> _______________________________________________
> Distutils-SIG maillist  -  Distutils-SIG at python.org
> http://mail.python.org/mailman/listinfo/distutils-sig
>
>



-- 
Tarek Ziadé | Association AfPy | www.afpy.org
Blog FR | http://programmation-python.org
Blog EN | http://tarekziade.wordpress.com/


More information about the Distutils-SIG mailing list