Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What do I have to install to resolve Could not find any typelib for GtkSource, Cannot import: GtkSourceView, cannot import name GtkSource

I'm trying to apply a patch for meld from https://bugzilla.gnome.org/show_bug.cgi?id=680569 myself, and am having trouble with this:

$ git clone git://git.gnome.org/meld
$ cd meld
$ python setup.py build
$ bin/meld 
2014-01-11 16:30:44,736 ERROR root: Could not find any typelib for GtkSource
Cannot import: GtkSourceView
cannot import name GtkSource

I know little about Python, and e.g. do not know (yet) what a typelib for Python is - enlighten me! ;-) I've looked around, and vaguely figured that this has something to do with an exotic fruit ;) named gir, but this doesn't seem to help:

$ sudo apt-get install gir1.2-gtk-3.0 
gir1.2-gtk-3.0 is already the newest version.
$ sudo apt-get install gir1.2-gtk-2.0 
The following NEW packages will be installed:
  gir1.2-gtk-2.0
Setting up gir1.2-gtk-2.0 (2.24.20-1ubuntu1) ...
$ bin/meld 
2014-01-11 16:32:24,133 ERROR root: Could not find any typelib for GtkSource
Cannot import: GtkSourceView
cannot import name GtkSource

What am I missing? Thank you!

like image 681
vorburger Avatar asked Jan 11 '14 15:01

vorburger


1 Answers

To install the library you need, on a Debian/Ubuntu machine:

sudo apt-get install gir1.2-gtksource-3.0

GtkSourceView is a C library that allows applications to display a text buffer with syntax highlight for code, and a bunch of other goodies.

https://wiki.gnome.org/Projects/GtkSourceView

The above package has the following description:

GtkSourceView is a text widget that extends the standard GTK+ 3.x text widget GtkTextView. It improves GtkTextView by implementing syntax highlighting and other features typical of a source editor. This package contains gobject introspection information.

Since Gtk+ 3.0 there is a system called Introspection that allows source code written in C to be analysed in order to dynamically generate bindings for other languages, like Python, Vala, etc. gir is for GObject Introspection Repository (I'm not sure about the R). Citing:

https://wiki.gnome.org/action/show/Projects/GObjectIntrospection?action=show&redirect=GObjectIntrospection#What_is_introspection.3F

GObject introspection is a middleware layer between C libraries (using GObject) and language bindings. The C library can be scanned at compile time and generate a metadata file, in addition to the actual native C library. Then at runtime, language bindings can read this metadata and automatically provide bindings to call into the C library.

like image 179
Havok Avatar answered Sep 21 '22 20:09

Havok