[Geany-Devel] New plugin loader mechanisms
kugel at xxxxx
Wed Mar 18 22:55:42 UTC 2015
Am 18.03.2015 um 23:21 schrieb Matthew Brush:
> On 15-03-18 03:05 PM, Thomas Martitz wrote:
>> Am 18.03.2015 um 22:15 schrieb Matthew Brush:
>>>>> void (*init) (GeanyPlugin *plugin, gpointer pdata);
>>>> Please make this gboolean. A plugin may have the correct API and ABI,
>>>> but be unable to startup / initialize for some reason. For example,
>>>> Scope requires scope.glade in the plugin data directory).
>> Thinking about it, if the plugin can't run because it's missing resource
>> files required for its operation, then I think it should be treaded like
>> incompatible plugins. This has the benefit that they will be attempted
>> to be loaded on the next startup if the user had previously selected it.
> For resource files like say a GtkBuilder UI file, I'd agree, but there
> may be some other cases, for example if a plugin dynamically loaded
> some particular library (or variant of a library) based on user
> configuration, it'd be useful to report to the user that the library
> is wrong, or no longer available, or whatever.
Based on user configuration implies that it's a decision that is made
after the plugin's init(). If it allows the user to configure it without
this dependency then the plugin is considered operational, and init()
should not fail. Remember that a init() == FALSE would imply that the
plugin cannot be activated, and therefore not configured (i.e. you
cannot configure back so that it doesn't need the missing dependency).
Such custom requirements & errors are better placed in the plugin code
>> I'm thinking if the plugin loaded successfully, then it should be
>> operational too. Meaning that init() should not fail, but simply
>> activate the plugin. As outlined above, my proposal already covers the
>> case "compatible but not operational due to missing runtime
>> dependencies" you described.
> For cases like GeanyPy which loads arbitrary Python scripts (which are
> even fully executed on import), and in a language where Exceptions are
> common (especially during development), it would probably be useful to
> signal that the plugin script couldn't be loaded and maybe even be
> able to provide a formatted traceback of the Python exception or such.
In my roadmap geanypy does not load scripts in its init(), but through a
separate API (so that the scripts integrate into the main plugin
manager). Anyway, geanypy init() isn't the right place because geanypy
can load multiple scripts, and which scripts can change afterwards after
init has run. And finally, all those scripts do not change the fact that
geanypy itself is operational, and this is what we're talking about.
More information about the Devel