Skip to content

meson.build: Rename Python 2 loader.

Pluma, the MATE text editor forked from gedit, is unable to enable plugins (External tools, Python Console, Quick Open, Snippets) due to missing /usr/lib/x86_64-linux-gnu/libpeas-1.0/loaders/libpythonloader.so.

The only reference to Python loader is at https://github.com/mate-desktop/pluma/blob/1.22/pluma/pluma-plugins-engine.c#L63

pluma/pluma-plugins-engine.c:63
    peas_engine_enable_loader (PEAS_ENGINE (engine), "python");

Looking at the libpeas code here's that function: https://github.com/GNOME/libpeas/blob/master/libpeas/peas-engine.c#L943

It still references python as Python 2 loader and then it calls peas_utils_get_loader_id to get loader id by name https://github.com/GNOME/libpeas/blob/master/libpeas/peas-utils.c#L257

libpeas/peas-utils.c:257
peas_utils_get_loader_id (const gchar *loader)

That function looks at all_plugin_loaders array with all known loaders names:

static const gchar *all_plugin_loaders[] = {
  "c", "lua5.1", "python", "python3"
};

 This is where the loader library name was changed without changing the loader name in the list of loaders: https://github.com/GNOME/libpeas/commit/dabb83a2e217694220a55c2019a081365a4a1288#diff-ad34de593e22ad307274456f3b4724a3

After that the autotools build files were dropped but you can see that the library was called libpythonloader in the makefile at that time: https://github.com/GNOME/libpeas/commit/eadd10dbdd5b9b6b0488aeb41d4bf1592ba9d5d2#diff-f2abb793309b0ed9d8e63c1e038b1e31  Here is a test case:

#include <libpeas/peas-engine.h>

int
main (int argc, char **argv) {
    PeasEngine *engine = peas_engine_get_default ();
    peas_engine_enable_loader (engine, "python2");
    return 0;
}

Build the above with:

gcc -Wall -o peas-test peas-test.c `pkg-config --cflags libpeas-1.0` `pkg-config --libs libpeas-1.0`

And run it:

$ ./peas-test

You'll get this output:

(process:13201): libpeas-WARNING **: 13:25:09.920: Failed to enable unknown plugin loader 'python2'

The Python 2 loader is still named python, therefore changing python loader name to python2 in Pluma would still result in libpeas not finding it. The merge request renames the Python 2 loader so that is can be found.

See downstream bug for reference: https://pad.lv/1846890

Merge request reports