Jason,
thanks for your kind reply.

I am afraid you are right, there is no standard way of getting package version 
info within Python code before importing.

I will use an "ad-hoc" procedure using the statement hasattr(), however this 
procedure has to be applied after importing (i.e. after initializing modules).

Regards, JP


--- El vie, 12/9/08, Jason Tackaberry <[EMAIL PROTECTED]> escribió:
De: Jason Tackaberry <[EMAIL PROTECTED]>
Asunto: Re: [Freevo-devel] Asking for ... package version info
Para: [EMAIL PROTECTED], freevo-devel@lists.sourceforge.net
Fecha: viernes, 12 septiembre, 2008 3:16

On Thu, 2008-09-11 at 14:37 +0000, Juan Pablo Soto Barrera wrote:
> After looking Freevo source and kaa-metadata, I could not find
> applicable examples either.

All kaa modules have a version submodule that can be imported.  It's a
bit roundabout, but it does work:

>>> import kaa.metadata
>>> print kaa.metadata.version.VERSION
0.7.4

kaa.metadata.version is a file version.py, VERSION is an object within
that whose __str__ method returns the stringified version. 

dischi: this is a bit lame.  I think we talked about this before.  Can't
we have kaa.metadata.version be the version object?  Does require having
the auto-generated version module be renamed to something else
(_version.py maybe) and explicitly have "from _version import *" in
the
modules' __init__.py (and rename VERSION to version).


> How to find out the version of a package available for importing?

It basically depends on the package.  There is no standard way of doing
this.  For kaa we have the version submodule.  pygtk doesn't it another
way:

>>> import gobject
>>> gobject.pygtk_version
(2, 14, 2)

If python-gdata does not do something similar, you're likely out of
luck.

Cheers,
Jason.




      
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Freevo-devel mailing list
Freevo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to