GNOME Bugzilla – Bug 754491
Don't emit require_version warning if namespace was loaded previously using g_irepository_require
Last modified: 2015-09-22 21:48:23 UTC
Reminder for me. Garrett mentioned on IRC that this introduces unnecessary warnings with Gedit plugins as some namespaces are loaded in C there: https://git.gnome.org/browse/gedit/tree/gedit/gedit-plugins-engine.c#n63 The current warning code doesn't take this into account and only hides warnings for dependencies if a namespace gets loaded through a Python import.
This is fairly annoying for applications that use libpeas for plugin support like gedit, gnome-builder, totem and rhythmbox. These are various commits required to fix the warnings and seem a bit excessive, i.e. requiring Gedit should also require GtkSource, Peas, PeasGtk, Gtk, Gdk, Pango, etc. https://git.gnome.org/browse/gedit/commit/plugins?id=65f1ba7eb37166159e30e0700ac1cc19a02c066f https://git.gnome.org/browse/gedit-plugins/commit/plugins?id=99919344491ec785d8751d50d95532002ee580b8 https://git.gnome.org/browse/gedit-plugins/commit/plugins?id=838a6313d5be3fab109a356c71c395bb96f92e19 https://git.gnome.org/browse/gedit-plugins/commit/plugins?id=908ff5b1c8482993cdf15115b7dbeea4ceda835f https://git.gnome.org/browse/gedit-plugins/commit/plugins?id=5e44fea8d5b3db31e4c066056bc15da13bb536a8 https://git.gnome.org/browse/gnome-builder/commit/?id=5dd1661172235fdf30dad4a88ce4b5f0dff5e77b
Created attachment 310730 [details] [review] on't emit require_version warning if namespace was loaded previously using g_irepository_require Instead of tracking loaded dependencies ourself to hide warnings if they were loaded by a previous import just look if the namespace was loaded before the import. This (a) makes the implementation much simpler and (b) also takes into account namespaces loaded outside of Python/PyGObject using the libgirepository C API (as is common in applications using libpeas with Python plugins) This also introduces a new Python wrapper for g_irepository_is_registered() to allow checking the loading state of namespaces before imports. This fixes unnecessary require_version warnings in gedit, gnome-builder, totem, rhythmbox etc.
This problem has been fixed in the unstable development version. The fix will be available in the next major software release. You may need to upgrade your Linux distribution to obtain that newer version.