After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 680176 - Added pygobject version accessors, and checker
Added pygobject version accessors, and checker
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: introspection
Git master
Other All
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2012-07-18 14:38 UTC by Joe R. Nassimian
Modified: 2012-07-19 13:51 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch providing the version accessors and checker (2.57 KB, patch)
2012-07-18 14:38 UTC, Joe R. Nassimian
none Details | Review
improved patch, with a seperate version checker (801 bytes, patch)
2012-07-19 12:26 UTC, Joe R. Nassimian
none Details | Review
version includes test cases (1.92 KB, patch)
2012-07-19 13:32 UTC, Joe R. Nassimian
none Details | Review

Description Joe R. Nassimian 2012-07-18 14:38:16 UTC
Created attachment 219128 [details] [review]
patch providing the version accessors and checker

Added the ability to check for pygobject's version at runtime in python.

To test it out:

>>> import gi
>>> gi.__version__
"3.3.5"
>>> gi.version_info
(3, 3, 5)
>>> gi.require_version("pygobject", "3.3.5")
>>> gi.require_version("pygobject", "3.5.5")
(interpreter throws an exception)
Comment 1 Joe R. Nassimian 2012-07-19 12:26:44 UTC
Created attachment 219220 [details] [review]
improved patch, with a seperate version checker

patch providing the version accessors and improved checker:

>>> import gi
>>> gi.__version__
"3.3.5"
>>> gi.version_info
(3, 3, 5)
>>> gi.check_version("3.3.5")
>>> gi.check_version((3.3.5))
>>> gi.check_version("3.4.5")
raises an exception
>>> gi.check_version((3.4.5))
raises an exception
Comment 2 Joe R. Nassimian 2012-07-19 12:28:28 UTC
There is a mistake in the previous comment, corrected here:

>>> gi.check_version("3.3.5")
>>> gi.check_version((3, 3, 5))
>>> gi.check_version("3.4.5")
raises an exception
>>> gi.check_version((3, 4, 5))
raises an exception
Comment 3 Joe R. Nassimian 2012-07-19 13:32:39 UTC
Created attachment 219225 [details] [review]
version includes test cases
Comment 4 Martin Pitt 2012-07-19 13:51:41 UTC
Thanks! Cleaned up the test case a bit, added a changelog, and pushed:

http://git.gnome.org/browse/pygobject/commit/?id=a3aae2e152c0b955037b7b85e16d14d00881d870