GNOME Bugzilla – Bug 697230
terminal: specify the requirement on Vte 2.90
Last modified: 2019-03-23 20:56:48 UTC
Several distributions (openSUSE, Mageia) use automatic dependency generation, based on code inspection. As the embedded terminal does not specify a specific version of Vte to load, the package dependency alorith will end up loading 'any' available one. This could result in Vte-0.0.typelib being pulled in. Loading the plugin fails in this case, as Vte 0.0 pulls in Gtk 2, whereas gedit requires Gtk 3 already. This is correctly blocked by the gi-loader. Specifying that the terminal requires Vte 2.90 avoids such issues and forces the right thing to happen. (see for example https://bugzilla.novell.com/show_bug.cgi?id=811434 )
Created attachment 240552 [details] [review] terminal: Specify the need for Vte 2.90. Several distributions (openSUSE, Mageia) use automatic dependency generation, based on code inspection. As the embedded terminal does not specify a specific version of Vte to load, the package dependency alorith will end up loading 'any' available one. This could result in Vte-0.0.typelib being pulled in. Loading the plugin fails in this case, as Vte 0.0 pulls in Gtk 2, whereas gedit requires Gtk 3 already. This is correctly blocked by the gi-loader. Specifying that the terminal requires Vte 2.90 avoids such issues and forces the right thing to happen.
Review of attachment 240552 [details] [review]: See comments inline. ::: plugins/terminal/terminal.py @@ +21,3 @@ # Boston, MA 02110-1301 USA +import gi.repository shouldn't this be just "import gi" ? @@ +22,3 @@ +import gi.repository +gi.require_version("Vte", "2.90") let's use the stable version number here?
Review of attachment 240552 [details] [review]: ::: plugins/terminal/terminal.py @@ +21,3 @@ # Boston, MA 02110-1301 USA +import gi.repository importing the whole introspection api sounds a bit scary... maybe we can just do from gi.repository import require_version ?
(In reply to comment #2) > Review of attachment 240552 [details] [review]: > > See comments inline. > > ::: plugins/terminal/terminal.py > @@ +21,3 @@ > # Boston, MA 02110-1301 USA > > +import gi.repository > > shouldn't this be just "import gi" ? I agree with Paolo here.. importing all of gi sounds like a large overhead. gi.repository is sufficient.. the code is tested. I will test if Paolo's variant 'from gi.repository import require_version' will work as well. > @@ +22,3 @@ > > +import gi.repository > +gi.require_version("Vte", "2.90") > > let's use the stable version number here? There has never been a release of Vte-3.0.typelib; See https://git.gnome.org/browse/vte/tree/configure.in?h=vte-0-34 (VTE_API_VERSION 2.90) and it remains to be noted that gi.require_version is == $VERSION, not a >= $VERSION.
(In reply to comment #3) > importing the whole introspection api sounds a bit scary... > maybe we can just do from gi.repository import require_version ? python -c "from gi.repository import require_version" ERROR:root:Could not find any typelib for require_version Traceback (most recent call last):
+ Trace 231726
=> not possible ( "from gi import require_version" could work.. but then we can't use gi.require_version, which would likely be more confusing). (In reply to comment #2) > > +import gi.repository > > shouldn't this be just "import gi" ? both works... all examples around seem to imply import gi.. (and it sort of looks more understandable to import gi and then make something out of gi.*)
Created attachment 240641 [details] [review] terminal: Require Vte 2.90. If for whatever reason we would end up loading Vte 0.0, the plugin will fail on a clash between Gtk3 (from gedit) and Gtk2 (from Vte 0.0).
Does this patch look better? Did do some of the requested rework... The version number for Vte can not be changed.. or we need a new Vte release :)
You import gi.repository.* bits anyway, so Python will (and has to) import its parents as well: $ python3 -c 'from gi.repository import Gtk; import sys; print("gi" in sys.modules)' True As you are calling a function from the gi module, you should also import it explicitly, so that second patch looks fine to me.
Comment on attachment 240641 [details] [review] terminal: Require Vte 2.90. Thanks for the reviews. Committed as https://git.gnome.org/browse/gedit-plugins/commit/?id=2e16e1c