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 697230 - terminal: specify the requirement on Vte 2.90
terminal: specify the requirement on Vte 2.90
Status: RESOLVED FIXED
Product: gedit-plugins
Classification: Other
Component: General
3.7.x
Other Linux
: Normal normal
: ---
Assigned To: Gedit maintainers
Gedit maintainers
Depends on:
Blocks:
 
 
Reported: 2013-04-03 22:16 UTC by Dominique Leuenberger
Modified: 2019-03-23 20:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
terminal: Specify the need for Vte 2.90. (1.32 KB, patch)
2013-04-03 22:17 UTC, Dominique Leuenberger
needs-work Details | Review
terminal: Require Vte 2.90. (904 bytes, patch)
2013-04-04 17:06 UTC, Dominique Leuenberger
committed Details | Review

Description Dominique Leuenberger 2013-04-03 22:16:45 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 )
Comment 1 Dominique Leuenberger 2013-04-03 22:17:31 UTC
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.
Comment 2 Ignacio Casal Quinteiro (nacho) 2013-04-04 06:21:13 UTC
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?
Comment 3 Paolo Borelli 2013-04-04 06:51:08 UTC
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 ?
Comment 4 Dominique Leuenberger 2013-04-04 07:04:50 UTC
(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.
Comment 5 Dominique Leuenberger 2013-04-04 17:04:56 UTC
(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):
  • File "<string>", line 1 in <module>
ImportError: cannot import name require_version

=> 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.*)
Comment 6 Dominique Leuenberger 2013-04-04 17:06:00 UTC
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).
Comment 7 Dominique Leuenberger 2013-04-13 19:08:43 UTC
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 :)
Comment 8 Martin Pitt 2013-04-17 06:37:20 UTC
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 9 Dominique Leuenberger 2013-04-17 18:35:40 UTC
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