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 625983 - g_irepository_enumerate_versions should also include typelibs imported with g_irepository_require_private
g_irepository_enumerate_versions should also include typelibs imported with g...
Status: RESOLVED FIXED
Product: gobject-introspection
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2010-08-03 22:43 UTC by Steve Frécinaux
Modified: 2015-02-07 16:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Include the loaded version in g_irepository_enumerate_versions() (2.31 KB, patch)
2010-08-16 20:55 UTC, Steve Frécinaux
reviewed Details | Review
Include the loaded version in g_irepository_enumerate_versions() (2.74 KB, patch)
2010-08-16 21:34 UTC, Steve Frécinaux
committed Details | Review

Description Steve Frécinaux 2010-08-03 22:43:16 UTC
If one requires a private typelib using g_irepository_require_private(), he won't be able to import it later in python.

The reason is that .enumerate_version doesn't enumerate private typelibs, but pygobject won't try to call repository.require if the namespace doesn't appear in enumerate_versions().
Comment 1 Steve Frécinaux 2010-08-11 19:06:11 UTC
A possible fix would be for g_irepository_enumerate_versions() to include already loaded versions of a typelib.

With the fact that g_irepository_require() will "work" (i.e. do nothing) for already loaded namespaces, this would have the nice effect of allowing one to do "from gi.repository import Private" after using the require_private() api from C code.
Comment 2 Colin Walters 2010-08-11 19:19:07 UTC
Would make sense to me for _enumerate to return loaded versions.
Comment 3 Tomeu Vizoso 2010-08-13 12:44:51 UTC
For anybody interested in doing what Walters said, it's a matter of augmenting what g_irepository_enumerate_versions returns with the contents of repository->priv->typelibs.

http://git.gnome.org/browse/gobject-introspection/tree/girepository/girepository.c#n1174
Comment 4 Steve Frécinaux 2010-08-16 20:55:22 UTC
Created attachment 168008 [details] [review]
Include the loaded version in g_irepository_enumerate_versions()

Logically speaking, the already loaded version of a namespace is part of
the currently available versions, and can be forgotten if we only
consider the versions available in GI_TYPELIB_PATH, as it could have
been loaded using g_irepository_require_private().

As a side effect, it meant that bindings relying on enumerate_version()
(like pygobject) were not able to require private versions through their
classical requirement scheme.

This patch fixes it by adding the loaded version to the unsorted list of
available versions returned by g_irepository_enumerate_versions()

This patch also uses g_list_prepend() instead of g_list_append() in that
function.
Comment 5 Colin Walters 2010-08-16 21:18:56 UTC
Review of attachment 168008 [details] [review]:

This looks good; can you also add a quick note to the function documentation?  Maybe just change "list of versions" to "list of versions (either currently loaded or available)".
Comment 6 Steve Frécinaux 2010-08-16 21:34:48 UTC
Created attachment 168012 [details] [review]
Include the loaded version in g_irepository_enumerate_versions()

Fix the documentation.
Comment 7 Steve Frécinaux 2010-08-18 18:08:41 UTC
Attachment 168012 [details] pushed as 3ed944e - Include the loaded version in g_irepository_enumerate_versions()
Comment 8 André Klapper 2015-02-07 16:52:04 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]