c-alpha / astroid

a graphical threads-with-tags style, lightweight and fast, email client for notmuch, inspired by sup and others
http://astroidmail.github.io
Other
1 stars 0 forks source link

missing plugins build #4

Closed c-alpha closed 6 years ago

c-alpha commented 7 years ago

See https://github.com/astroidmail/astroid/blob/master/SConstruct

c-alpha commented 7 years ago

This also needs to include the gobject-introspection compilation steps.

c-alpha commented 7 years ago

@gauteh, I have a question on your preferred way.

Since webkit also uses cmake, I would like to take advantage of the prior art they created for using the GObject introspection tools, which can be found at https://trac.webkit.org/browser/webkit/trunk/Source/cmake/FindGObjectIntrospection.cmake

I.e. we're talking about pulling in a single file from their repo. We can either simply create a local copy of it an add that to the astroid repo, or use one of the ways described in https://stackoverflow.com/questions/15844542/git-symlink-reference-to-a-file-in-an-external-repository/27770463#27770463 to include it as a git submodule.

I would personally tend to prefer the former option (create a local copy of it an add that to the astroid repo) as the submodule setup seems more fragile to me.

What do you reckon?

gauteh commented 7 years ago

c-alpha writes on oktober 19, 2017 14:05:

I would personally tend to prefer the former option (create a local copy of it an add that to the astroid repo) as the submodule setup seems more fragile to me.

What do you reckon?

I agree, do the former. Then we avoid submodules, and besides the file is not that big. It is BSD license, so we'd have to acknowledge that, maybe @hugoroy could comment.

c-alpha commented 7 years ago

I agree, do the former. Then we avoid submodules, and besides the file is not that big. It is BSD license, so we'd have to acknowledge that, maybe @hugoroy could comment.

I have found the initial, canonical source for the CMake macros at https://cgit.freedesktop.org/poppler/poppler/tree/cmake/modules, which also has a licence file at https://cgit.freedesktop.org/poppler/poppler/tree/cmake/modules/COPYING-CMAKE-SCRIPTS. So in addition to the FindGObjectIntrospection.cmake file from the wbkit repo, I think I would like to use the GObjectIntrospectionMacros.cmake script from freedesktop.

Interestingly the FindGObjectIntrospection.cmake from webkit has an additional copyright from 2014 (all initial versions from Pino Toscano are marked 2010), has the reference to COPYING-CMAKE-SCRIPTS removed, and extends the _gir_get_pkgconfig_var macro by an extra arg which is passed on to pkg-config. So appears to be a derivative work?

For the avoidance of doubt, I will need to use both scripts, FindGObjectIntrospection.cmake and GObjectIntrospectionMacros.cmake.

c-alpha commented 7 years ago

Interestingly the FindGObjectIntrospection.cmake from webkit has an additional copyright from 2014 (all initial versions from Pino Toscano are marked 2010), has the reference to COPYING-CMAKE-SCRIPTS removed, and extends the _gir_get_pkgconfig_var macro by an extra arg which is passed on to pkg-config. So appears to be a derivative work?

Forgot to mention that the extra arg is subsequently not used (i.e. on invocations is passed as the empty string ""). So maybe the purpose of creating a derivative was to get away from the original licence? Just my 2 cents... Holding my breath for @hugoroy now. ;-)

gauteh commented 7 years ago

Maybe their custom license is compatible with BSD - either way, while astroid in general is GPL it contains parts that were scavenged from works with various versions of it. We should be good if we just add the BSD short licence to https://github.com/astroidmail/astroid/blob/master/LICENSE.md, and specify that it applies to the initially copied parts of the CMake files.

c-alpha commented 7 years ago

Ok, I've gotten as far as invoking g-ir-scanner, but which breaks with an error for which I can't seem to figure out the reason:

/usr/local/Cellar/gobject-introspection/1.54.1/bin/g-ir-scanner --namespace=astroid --nsversion=v0.10.2-10-g9664dad3 --no-libtool --program=gir_main --include=GObject-2.0 --include=GMime-3.0 /Users/alexanderadolf/Projects/astroid/src/plugin/astroid_activatable.c /Users/alexanderadolf/Projects/astroid/src/plugin/thread_view_activatable.c /Users/alexanderadolf/Projects/astroid/src/plugin/thread_index_activatable.c /Users/alexanderadolf/Projects/astroid/src/plugin/astroid_activatable.h /Users/alexanderadolf/Projects/astroid/src/plugin/thread_view_activatable.h /Users/alexanderadolf/Projects/astroid/src/plugin/thread_index_activatable.h /Users/alexanderadolf/Projects/astroid/src/plugin/gir_main.c --output /Users/alexanderadolf/Projects/astroid/_build/astroid-v0.10.2-10-g9664dad3.gir
Traceback (most recent call last):
  File "/usr/local/Cellar/gobject-introspection/1.54.1/bin/g-ir-scanner", line 66, in <module>
    sys.exit(scanner_main(sys.argv))
  File "/usr/local/Cellar/gobject-introspection/1.54.1/lib/gobject-introspection/giscanner/scannermain.py", line 547, in scanner_main
    shlibs = create_binary(transformer, options, args)
  File "/usr/local/Cellar/gobject-introspection/1.54.1/lib/gobject-introspection/giscanner/scannermain.py", line 426, in create_binary
    gdump_parser.parse()
  File "/usr/local/Cellar/gobject-introspection/1.54.1/lib/gobject-introspection/giscanner/gdumpparser.py", line 115, in parse
    tree = self._execute_binary_get_tree()
  File "/usr/local/Cellar/gobject-introspection/1.54.1/lib/gobject-introspection/giscanner/gdumpparser.py", line 177, in _execute_binary_get_tree
    subprocess.check_call(args, stdout=sys.stdout, stderr=sys.stderr)
  File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 181, in check_call
    retcode = call(*popenargs, **kwargs)
  File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 168, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 390, in __init__
    errread, errwrite)
  File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1025, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

I'm at loss as to what it's not finding. Any hints appreciated!

gauteh commented 7 years ago

Have you built the gir_main binary? Also nsversion should be 0.1 or similar I think. Here is the relevant build commands when using meson:

[1/34] cc  -Igir_main@exe -I. -I.. -I../src -I/usr/include/gmime-3.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gtkmm-3.0 -I/usr/lib/gtkmm-3.0/include -I/usr/include/atkmm-1.6 -I/usr/include/gtk-3.0/unix-print -I/usr/include/gdkmm-3.0 -I/usr/lib/gdkmm-3.0/include -I/usr/include/giomm-2.4 -I/usr/lib/giomm-2.4/include -I/usr/include/pangomm-1.4 -I/usr/lib/pangomm-1.4/include -I/usr/include/glibmm-2.4 -I/usr/lib/glibmm-2.4/include -I/usr/include/cairomm-1.0 -I/usr/lib/cairomm-1.0/include -I/usr/include/sigc++-2.0 -I/usr/lib/sigc++-2.0/include -I/usr/include/libsoup-2.4 -I/usr/include/libxml2 -I/usr/include/webkitgtk-3.0 -I/usr/include/vte-2.91 -I/usr/include/p11-kit-1 -I/usr/include/libpeas-1.0 -I/usr/include/gobject-introspection-1.0 -I/usr/lib/libffi-3.2.1/include -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O0 -g -pthread -D_LARGEFILE64_SOURCE -MMD -MQ 'gir_main@exe/src_plugin_thread_index_activatable.c.o' -MF 'gir_main@exe/src_plugin_thread_index_activatable.c.o.d' -o 'gir_main@exe/src_plugin_thread_index_activatable.c.o' -c ../src/plugin/thread_index_activatable.c
[2/34] cc  -Igir_main@exe -I. -I.. -I../src -I/usr/include/gmime-3.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gtkmm-3.0 -I/usr/lib/gtkmm-3.0/include -I/usr/include/atkmm-1.6 -I/usr/include/gtk-3.0/unix-print -I/usr/include/gdkmm-3.0 -I/usr/lib/gdkmm-3.0/include -I/usr/include/giomm-2.4 -I/usr/lib/giomm-2.4/include -I/usr/include/pangomm-1.4 -I/usr/lib/pangomm-1.4/include -I/usr/include/glibmm-2.4 -I/usr/lib/glibmm-2.4/include -I/usr/include/cairomm-1.0 -I/usr/lib/cairomm-1.0/include -I/usr/include/sigc++-2.0 -I/usr/lib/sigc++-2.0/include -I/usr/include/libsoup-2.4 -I/usr/include/libxml2 -I/usr/include/webkitgtk-3.0 -I/usr/include/vte-2.91 -I/usr/include/p11-kit-1 -I/usr/include/libpeas-1.0 -I/usr/include/gobject-introspection-1.0 -I/usr/lib/libffi-3.2.1/include -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O0 -g -pthread -D_LARGEFILE64_SOURCE -MMD -MQ 'gir_main@exe/src_plugin_thread_view_activatable.c.o' -MF 'gir_main@exe/src_plugin_thread_view_activatable.c.o.d' -o 'gir_main@exe/src_plugin_thread_view_activatable.c.o' -c ../src/plugin/thread_view_activatable.c
[3/34] c++  -o gir_main 'gir_main@exe/src_plugin_astroid_activatable.c.o' 'gir_main@exe/src_plugin_thread_view_activatable.c.o' 'gir_main@exe/src_plugin_thread_index_activatable.c.o' 'gir_main@exe/src_plugin_gir_main.c.o' -Wl,--no-undefined -Wl,--as-needed -pthread -Wl,--start-group -lgmime-3.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -Wl,--end-group -lboost_thread -lboost_filesystem -lboost_log_setup -lboost_log -lboost_date_time -lboost_system -lboost_program_options -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 -lglibmm-2.4 -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lgio-2.0 -lcairomm-1.0 -lcairo -lsigc-2.0 -lgdk_pixbuf-2.0 -lgobject-2.0 -lglib-2.0 -lwebkitgtk-3.0 -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lsoup-2.4 -lgio-2.0 -lgobject-2.0 -ljavascriptcoregtk-3.0 -lglib-2.0 -lnotmuch -lvte-2.91 -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lz -lpcre2-8 -lgnutls -lsass -lpeas-1.0 -Wl,--export-dynamic -lgmodule-2.0 -pthread -lgio-2.0 -lgirepository-1.0 -lgobject-2.0 -lglib-2.0  
[4/34] /usr/bin/g-ir-scanner -pthread -I/usr/include/gobject-introspection-1.0 -I/usr/lib/libffi-3.2.1/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include --no-libtool --namespace=Astroid --nsversion=0.1 --warn-all --output Astroid-0.1.gir -I/home/gaute/dev/mail/notm/astroid/ -I/home/gaute/dev/mail/notm/astroid/build/ -I./src -I../src --filelist=/home/gaute/dev/mail/notm/astroid/build/gir_main@exe/Astroid_0.1_gir_filelist --include=GObject-2.0 --include=GMime-3.0 --cflags-begin -D_LARGEFILE64_SOURCE -pthread -I/usr/include/gmime-3.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gtkmm-3.0 -I/usr/lib/gtkmm-3.0/include -I/usr/include/atkmm-1.6 -I/usr/include/gtk-3.0/unix-print -I/usr/include/gdkmm-3.0 -I/usr/lib/gdkmm-3.0/include -I/usr/include/giomm-2.4 -I/usr/lib/giomm-2.4/include -I/usr/include/pangomm-1.4 -I/usr/lib/pangomm-1.4/include -I/usr/include/glibmm-2.4 -I/usr/lib/glibmm-2.4/include -I/usr/include/cairomm-1.0 -I/usr/lib/cairomm-1.0/include -I/usr/include/sigc++-2.0 -I/usr/lib/sigc++-2.0/include -I/usr/include/webkitgtk-3.0 -I/usr/include/libsoup-2.4 -I/usr/include/libxml2 -I/usr/include/vte-2.91 -I/usr/include/p11-kit-1 -I/usr/include/libpeas-1.0 -I/usr/include/gobject-introspection-1.0 -I/usr/lib/libffi-3.2.1/include --cflags-end --extra-library=gmime-3.0 --extra-library=gdk-3 --extra-library=boost_log --extra-library=cairo --extra-library=boost_log_setup --extra-library=glib-2.0 --extra-library=vte-2.91 --extra-library=peas-1.0 --extra-library=gtkmm-3.0 --extra-library=notmuch --extra-library=giomm-2.4 --extra-library=gobject-2.0 --extra-library=pangomm-1.4 --extra-library=boost_thread --extra-library=cairomm-1.0 --extra-library=gnutls --extra-library=atkmm-1.6 --extra-library=cairo-gobject --extra-library=pcre2-8 --extra-library=boost_date_time --extra-library=z --extra-library=pango-1.0 --extra-library=atk-1.0 --extra-library=boost_system --extra-library=pangocairo-1.0 --extra-library=gdkmm-3.0 --extra-library=boost_program_options --extra-library=gdk_pixbuf-2.0 --extra-library=soup-2.4 --extra-library=sass --extra-library=webkitgtk-3.0 --extra-library=girepository-1.0 --extra-library=sigc-2.0 --extra-library=javascriptcoregtk-3.0 --extra-library=gio-2.0 --extra-library=boost_filesystem --extra-library=gmodule-2.0 --extra-library=gtk-3 -pthread --extra-library=glibmm-2.4 -I./src -I../src --add-include-path=./src --add-include-path=../src --program /home/gaute/dev/mail/notm/astroid/build/gir_main
[5/34] /usr/bin/g-ir-compiler Astroid-0.1.gir --output Astroid-0.1.typelib
c-alpha commented 7 years ago

Also nsversion should be 0.1 or similar I think.

Your original SConstruct did a git describe --abbrev=8 --tags --always, which I simply copied for my cmake branch. I have now updated the command to use --abbrev=0 (removes the -gxxx gibberish at the end, and some regex magic to remove the leading v. Now the version retrieved from git comes out as 0.10.2 (just like hard-coded in your meson.build)

Have you built the gir_main binary?

Bummer! It tends to help when I rtfm. ;-)

I'm now building the gir_mainexecutable, which resolves the OSError: [Errno 2] No such file or directory. I now get a different error (UnboundLocalError: local variable 'interface_name' referenced before assignment), so will have to have a closer look at how you invoke g-ir-scanner.

gauteh commented 7 years ago

c-alpha writes on oktober 26, 2017 17:10:

Also nsversion should be 0.1 or similar I think.

Your original SConstruct did a git describe --abbrev=8 --tags --always, which I simply copied for my cmake branch. I have now updated the command to use --abbrev=0 (removes the -gxxx gibberish at the end, and some regex magic to remove the leading v. Now the version retrieved from git comes out as 0.10.2 (just like hard-coded in your meson.build)

The nsversion refers to the Astroid-plugin API version.

The main Astroid version can be hardcoded for release builds (so that the git repo isn't necessary to build). Otherwise it should also contain the -g gibberish (default Debug builds), so that we know which commit it is. If there are commits on top of a tag they will be shown in that part, if there are no commits after the tag (release) it will evaluate to just the version.

Hopefully the g-ir stuff can be resolved!

hugoroy commented 7 years ago

Hi everyone,

I haven't read the license in question, but if it is one of the recent BSD it should be no problem.

I don't have much time, but if there's a new license and an import of copyrighted material from outside, then:

Maybe one day we should do this less "artisanal" and more automatically. Freel free to have a look at https://reuse.software/

Best, Hugo

c-alpha commented 7 years ago

@gauteh wrote:

The main Astroid version can be hardcoded for release builds (so that the git repo isn't necessary to build). Otherwise it should also contain the -g gibberish (default Debug builds), so that we know which commit it is. If there are commits on top of a tag they will be shown in that part, if there are no commits after the tag (release) it will evaluate to just the version.

Implemented with c-alpha/astroid@fe45642aa31478ca579a8aa4099bfda1abeefe25.

c-alpha commented 7 years ago

Ok, I can build with plugin support (no warnings or error messages at least). How can I check that plugins are working? In the console output I get this:

[18:23:07.600283] [0x00007fff8ef82340] [info] plugins: starting manager..
[18:23:07.600829] [0x00007fff8ef82340] [debug] plugins: adding path: /usr/local/share/astroid/plugins
[18:23:07.600965] [0x00007fff8ef82340] [debug] plugin: adding path: /Users/alexanderadolf/.config/astroid/plugins
[18:23:07.601035] [0x00007fff8ef82340] [debug] plugins: refreshing..
[18:23:07.601086] [0x00007fff8ef82340] [debug] plugins: found 0 plugins.

I guess now I'd need a plugin to load?

c-alpha commented 7 years ago

I stumbled across astroidmail/astroid-plugins. I installed the astroid-plugin-hls-hsv-tagcolor, with the following result:

[18:35:28.986560] [0x00007fff8ef82340] [info] plugins: starting manager..
[18:35:28.986693] [0x00007fff8ef82340] [debug] plugins: adding path: /usr/local/share/astroid/plugins
[18:35:28.986768] [0x00007fff8ef82340] [debug] plugin: adding path: /Users/alexanderadolf/.config/astroid/plugins
[18:35:28.987161] [0x00007fff8ef82340] [debug] plugins: refreshing..
[18:35:28.987367] [0x00007fff8ef82340] [debug] plugins: found 1 plugins.
[18:35:28.987408] [0x00007fff8ef82340] [debug] plugins: loading: HSV tag color

(<unknown>:26115): libpeas-WARNING **: Failed to load module 'python3loader': dlopen(/usr/local/Cellar/libpeas/1.22.0/lib/libpeas-1.0/loaders/libpython3loader.so, 10): image not found

(<unknown>:26115): libpeas-WARNING **: Could not load plugin loader 'python3'
[18:35:28.989051] [0x00007fff8ef82340] [error] plugins: failed loading: HSV tag color

A find /usr/local/Cellar/libpeas -name "*loader*" didn't reveal anything. So I guess homebrew's libpeas is missing this bit?

Same result for any other of the plugins, btw.

Or is it a python issue? https://askubuntu.com/questions/291454/libpeas-warning-could-not-find-loader-python3-for-plugin-when-loading-a

gauteh commented 7 years ago

c-alpha writes on november 4, 2017 18:43:

I stumbled across astroidmail/astroid-plugins. I installed the astroid-plugin-hls-hsv-tagcolor, with the following result:

[18:35:28.986560] [0x00007fff8ef82340] [info] plugins: starting manager..
[18:35:28.986693] [0x00007fff8ef82340] [debug] plugins: adding path: /usr/local/share/astroid/plugins
[18:35:28.986768] [0x00007fff8ef82340] [debug] plugin: adding path: /Users/alexanderadolf/.config/astroid/plugins
[18:35:28.987161] [0x00007fff8ef82340] [debug] plugins: refreshing..
[18:35:28.987367] [0x00007fff8ef82340] [debug] plugins: found 1 plugins.
[18:35:28.987408] [0x00007fff8ef82340] [debug] plugins: loading: HSV tag color

(<unknown>:26115): libpeas-WARNING **: Failed to load module 'python3loader': dlopen(/usr/local/Cellar/libpeas/1.22.0/lib/libpeas-1.0/loaders/libpython3loader.so, 10): image not found

(<unknown>:26115): libpeas-WARNING **: Could not load plugin loader 'python3'
[18:35:28.989051] [0x00007fff8ef82340] [error] plugins: failed loading: HSV tag color

A find /usr/local/Cellar/libpeas -name "*loader*" didn't reveal anything. So I guess homebrew's libpeas is missing this bit.

You can try to change the line Loader=python3 to Loader=python for hls-hsv-tag-color.plugin as mentioned in the stackoverflow answer.

Regards, Gaute

c-alpha commented 7 years ago

You can try to change the line Loader=python3 to Loader=python for hls-hsv-tag-color.plugin as mentioned in the stackoverflow answer.

No luck:

[22:48:45.144458] [0x00007fff8ef82340] [debug] plugins: found 1 plugins.
[22:48:45.144498] [0x00007fff8ef82340] [debug] plugins: loading: HSV tag color

(<unknown>:35282): libpeas-WARNING **: The 'python' plugin loader has not been enabled
[22:48:45.144626] [0x00007fff8ef82340] [error] plugins: failed loading: HSV tag color

Maybe PyGObject (most likely --with-libffi --with-python3) needs to be installed? http://bugzilla.redhat.com/show_bug.cgi?id=1293069

gauteh commented 7 years ago

c-alpha writes on november 4, 2017 23:05:

You can try to change the line Loader=python3 to Loader=python for hls-hsv-tag-color.plugin as mentioned in the stackoverflow answer.

No luck:

[22:48:45.144458] [0x00007fff8ef82340] [debug] plugins: found 1 plugins.
[22:48:45.144498] [0x00007fff8ef82340] [debug] plugins: loading: HSV tag color

(<unknown>:35282): libpeas-WARNING **: The 'python' plugin loader has not been enabled
[22:48:45.144626] [0x00007fff8ef82340] [error] plugins: failed loading: HSV tag color

huh, weird :) You could try to add python aswell to python3 and lua5.1 to plugin/manager.cc:41.

Great that you got so far!! This is looking promising!

Cheers, Gaute

c-alpha commented 7 years ago

huh, weird :) You could try to add python aswell to python3 and lua5.1 to plugin/manager.cc:41.

Still no luck:

(<unknown>:36512): libpeas-WARNING **: Failed to load module 'pythonloader': dlopen(/usr/local/Cellar/libpeas/1.22.0/lib/libpeas-1.0/loaders/libpythonloader.so, 10): image not found

(<unknown>:36512): libpeas-WARNING **: Could not load plugin loader 'python'

I have nothing that would even faintly smell of a python loader of sorts in my /usr/local. find /usr/local -name "*ython*oader*" returns nothing.

gauteh commented 7 years ago

c-alpha writes on november 4, 2017 23:32:

huh, weird :) You could try to add python aswell to python3 and lua5.1 to plugin/manager.cc:41.

Still no luck:

(<unknown>:36512): libpeas-WARNING **: Failed to load module 'pythonloader': dlopen(/usr/local/Cellar/libpeas/1.22.0/lib/libpeas-1.0/loaders/libpythonloader.so, 10): image not found

(<unknown>:36512): libpeas-WARNING **: Could not load plugin loader 'python'

I have nothing that would even faintly smell of a python loader of sorts in my /usr/local. find /usr/local -name "*ython*oader*" returns nothing.

Weird - does libpeas even work on Mac OS (with python)? What's the file list of the homebrew package?

Here's the list on Arch: https://gist.github.com/gauteh/932756f6e9404184ed92bcb8b3f95497

c-alpha commented 7 years ago

Weird - does libpeas even work on Mac OS (with python)? What's the file list of the homebrew package?

hb-libpeas-1.22.0-files.txt

Here's the list on Arch: https://gist.github.com/gauteh/932756f6e9404184ed92bcb8b3f95497

Now it's clear. The homebrew version of libpeas is compiled without python support (cf. the formula). Looking at the libpeas source code, python must be explicitly enabled with ./configure --enable-python2 --enable-python3 (same for lua, btw.).

I'll submit a PR for the libpeas homebrew formula.

c-alpha commented 7 years ago

I'll submit a PR for the libpeas homebrew formula.

First finding from compiling libpeas with --enable-python3:

configure: error: You need to have Python 3 and PyGObject installed to build libpeas

Both suspicions are thus confirmed:

  1. The homebrew libpeas lacks python support
  2. PyGObject is a required package when building astroid with plugins
gauteh commented 7 years ago

c-alpha writes on november 5, 2017 14:13:

I'll submit a PR for the libpeas homebrew formula.

First finding from compiling libpeas with --enable-python3:

configure: error: You need to have Python 3 and PyGObject installed to build libpeas

Both suspicions are thus confirmed:

  1. The homebrew libpeas lacks python support
  2. PyGObject is a required package when building astroid with plugins

Hopefully that is not too difficult! Seems like you are getting closer...

gauteh commented 7 years ago

Gaute Hope writes on november 5, 2017 22:13:

c-alpha writes on november 5, 2017 14:13:

I'll submit a PR for the libpeas homebrew formula.

First finding from compiling libpeas with --enable-python3:

configure: error: You need to have Python 3 and PyGObject installed to build libpeas

Both suspicions are thus confirmed:

  1. The homebrew libpeas lacks python support
  2. PyGObject is a required package when building astroid with plugins

Hopefully that is not too difficult! Seems like you are getting closer...

Is the plugin-stuff online somewhere? Then I can test if it works on linux.

c-alpha commented 6 years ago

I am able to compile libpeas with python support. Now need to get the formula in shape for submitting to homebrew.

Now the HSV plugin complains about API version mismatch. It expects 0.1 or better, but I’m building a debug version of astroid with an extended version tag.

One problem at a time... ;-)

gauteh commented 6 years ago

c-alpha writes on november 10, 2017 14:16:

I am able to compile libpeas with python support. Now need to get the formula in shape for submitting to homebrew.

Now the HSV plugin complains about API version mismatch. It expects 0.1 or better, but I’m building a debug version of astroid with an extended version tag.

Great!! That is related to the --nsversion stuff (or one of the other falgs), it basically defines the plugin API - should be hardcoded to 0.1 at the moment. It is not directly related to astroid version.

c-alpha commented 6 years ago

I have just pushed the plugins build support to my cmake branch (c-alpha/astroid@9746a037a6b8a84b0d5f005aba5f73dbc7ce1b9a).

I still get a "Namespace Astroid not available", however (cf. below). Do I need to install before plugins can work?

[21:25:43.396922] [0x00007fff8ef82340] [info] plugins: starting manager..
[21:25:43.397371] [0x00007fff8ef82340] [debug] plugins: adding path: /usr/local/share/astroid/plugins
[21:25:43.397679] [0x00007fff8ef82340] [debug] plugin: adding path: /Users/alexanderadolf/.config/astroid/plugins
[21:25:43.399309] [0x00007fff8ef82340] [debug] plugins: refreshing..
[21:25:43.399914] [0x00007fff8ef82340] [debug] plugins: found 1 plugins.
[21:25:43.424901] [0x00007fff8ef82340] [debug] plugins: loading: HSV tag color

(<unknown>:41983): libpeas-WARNING **: Error importing plugin 'hls-hsv-tag-color':
Traceback (most recent call last):
  File "/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/alexanderadolf/.config/astroid/plugins/astroid-plugin-hls-hsv-tagcolor/hls-hsv-tag-color.py", line 2, in <module>
    gi.require_version ('Astroid', '0.1')
  File "/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/gi/__init__.py", line 130, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace Astroid not available

(<unknown>:41983): libpeas-WARNING **: Error loading plugin 'hls-hsv-tag-color'
[21:25:43.561745] [0x00007fff8ef82340] [error] plugins: failed loading: HSV tag color
gauteh commented 6 years ago

You have to set GI_TYPLELIB path or similar, see examples/astroid script.

-g

c-alpha writes on november 13, 2017 21:44:

I have just pushed the plugins build support to my cmake branch (c-alpha/astroid@80b6ddeb4fc3a919f0b9db7a8c9b75c8e11257f5).

I still get a "Namespace Astroid not available", however (cf. below). Do I need to install before plugins can work?

[21:25:43.396922] [0x00007fff8ef82340] [info] plugins: starting manager..
[21:25:43.397371] [0x00007fff8ef82340] [debug] plugins: adding path: /usr/local/share/astroid/plugins
[21:25:43.397679] [0x00007fff8ef82340] [debug] plugin: adding path: /Users/alexanderadolf/.config/astroid/plugins
[21:25:43.399309] [0x00007fff8ef82340] [debug] plugins: refreshing..
[21:25:43.399914] [0x00007fff8ef82340] [debug] plugins: found 1 plugins.
[21:25:43.424901] [0x00007fff8ef82340] [debug] plugins: loading: HSV tag color

(<unknown>:41983): libpeas-WARNING **: Error importing plugin 'hls-hsv-tag-color':
Traceback (most recent call last):
  File "/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/alexanderadolf/.config/astroid/plugins/astroid-plugin-hls-hsv-tagcolor/hls-hsv-tag-color.py", line 2, in <module>
    gi.require_version ('Astroid', '0.1')
  File "/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/gi/__init__.py", line 130, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace Astroid not available

(<unknown>:41983): libpeas-WARNING **: Error loading plugin 'hls-hsv-tag-color'
[21:25:43.561745] [0x00007fff8ef82340] [error] plugins: failed loading: HSV tag color

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/c-alpha/astroid/issues/4#issuecomment-344051812

c-alpha commented 6 years ago

If you want to try it out, be sure to apply PR Homebrew/homebrew-core#20586 (python support in libpeas). I'm waiting for the homebrew maintainers to pick it up. Once that will have happened, you'll need to update the astroid homebres formula to require libpeas --with-python.

c-alpha commented 6 years ago

You have to set GI_TYPLELIB path or similar, see examples/astroid script.

Thanks for the hint. This changes the behaviour, and allows me to proceed to the next problem: Namespace WebKit not available.

Is there a way to generate introspection data without rebuilding webkitgtk (which takes very long on my small machine)? Or is the switch to webkitgtk@2.18.3 close enough (see astroidmail/astroid#49) to not bother?

gauteh commented 6 years ago

I think you can steal the typelib and gir files from another package. wkgir.tar.gz

gauteh commented 6 years ago

Seems to work, I had to also add the PEAS_INCLUDE_DIR for linux - don't think it should only be added for apple.

gauteh commented 6 years ago

Works on linux with the change above!

c-alpha commented 6 years ago

Seems to work, I had to also add the PEAS_INCLUDE_DIR for linux - don't think it should only be added for apple.

Implemented with c-alpha/astroid@ f778799782cd4270fe47dc5704eda10c3fb0725d.

c-alpha commented 6 years ago

I think you can steal the typelib and gir files from another package. wkgir.tar.gz

Thanks for the pointer. But kind of, ...not.

** (<unknown>:59282): WARNING **: Failed to load shared library 'libwebkitgtk-3.0.so.0' referenced by the typelib: dlopen(libwebkitgtk-3.0.so.0, 9): image not found
** (<unknown>:59282): WARNING **: Failed to load shared library 'libjavascriptcoregtk-3.0.so.0' referenced by the typelib: dlopen(libjavascriptcoregtk-3.0.so.0, 9): image not found

Both exist in /usr/local/lib as libwebkitgtk-3.0.dylib and libjavascriptcoregtk-3.0.dylib respectively. The different naming conventions for the shared libs break it. Did I just hear anyone yell "interoperability!" from the background? ;-))

But I think we can save this for dependency fine-tuning later.

I ditched the HSV plugin, and installed the official-examples ones.

The ThreadViewExamplePlugin plugin breaks with a python error:

(<unknown>:59727): libpeas-WARNING **: Error importing plugin 'threadview':
Traceback (most recent call last):
  File "/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 674, in exec_module
  File "<frozen importlib._bootstrap_external>", line 781, in get_code
  File "<frozen importlib._bootstrap_external>", line 741, in source_to_code
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/alexanderadolf/.config/astroid/plugins/ThreadViewExamplePlugin/threadview.py", line 17
    def do_activate (self):
                          ^
IndentationError: unindent does not match any outer indentation level

(<unknown>:59727): libpeas-WARNING **: Error loading plugin 'threadview'

The other two (AstroidGenericExamplePlugin and ThreadIndexExamplePlugin work fine after an additional pip3 install ipython however:

[23:31:04.486448] [0x00007fff8ef82340] [info] plugins: starting manager..
[23:31:04.486594] [0x00007fff8ef82340] [debug] plugins: adding path: /usr/local/share/astroid/plugins
[23:31:04.486683] [0x00007fff8ef82340] [debug] plugin: adding path: /Users/alexanderadolf/.config/astroid/plugins
[23:31:04.487334] [0x00007fff8ef82340] [debug] plugins: refreshing..
[23:31:04.487765] [0x00007fff8ef82340] [debug] plugins: found 2 plugins.
[23:31:04.487807] [0x00007fff8ef82340] [debug] plugins: loading: basic plugin
basic: plugin loading..
[23:31:04.585159] [0x00007fff8ef82340] [debug] plugins: loaded: basic plugin
[23:31:04.585304] [0x00007fff8ef82340] [debug] plugins: registering astroid plugin..
[23:31:04.585434] [0x00007fff8ef82340] [debug] plugins: loading: tagformat
tagformat: plugin loading..
[23:31:04.622621] [0x00007fff8ef82340] [debug] plugins: loaded: tagformat
[23:31:04.622771] [0x00007fff8ef82340] [debug] plugins: registering threadindex plugin..
[23:31:04.623126] [0x00007fff8ef82340] [debug] plugins: activating astroid plugin: basic plugin
basic: activate

When I open a thread view, the tags lose their colours, and the lower half of the window shows "Hullu!" (apparently dome friendly greeting from you?).

To me, this seems sufficient evidence that python plugins can be loaded and do run correctly. I am hence closing this issue, since I think the GObject introspection dependencies apply to astroid as a whole, and are not specific to the cmake build.

gauteh commented 6 years ago

Yes, I've confirmed that it works on linux. Great work!!