Comment 4 for bug 1616656

Revision history for this message
Mike McCracken (mikemc) wrote : Re: [Bug 1616656] intermittent failure to load correct plugin when alocal plugin is a subclass of existing plugin

heh, thanks again - apparently I'd searched for 'local' on that page
instead of 'custom'.
d'oh!

On Thu, Aug 25, 2016 at 6:54 AM, Sergio Schvezov <<email address hidden>
> wrote:

> El miércoles, 24 de agosto de 2016 23h'34:56 ART, Mike McCracken
> <email address hidden> escribió:
> > Thanks for the workaround.
> >
> > I'd be fine with any naming convention as long as it was documented.
> > (BTW, speaking of docs, it was hard to tell where to put the local plugin
> > relative to the snapcraft yaml - I had to add a print to the snapcraft
> > source to see where it was looking. I didn't find any documentation
> > covering local plugins.)
>
> In fear of deviating from the original bug topic I share this:
> http://snapcraft.io/docs/build-snaps/plugins
>
>
> --
> Enviado con Dekko desde mi dispositivo Ubuntu
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1616656
>
> Title:
> intermittent failure to load correct plugin when a local plugin is a
> subclass of existing plugin
>
> Status in Snapcraft:
> Triaged
>
> Bug description:
>
> I have a local plugin called 'perlmake' that is a subclass of the
> MakePlugin class. It calls "perl Makefile.PL" to generate a "Makefile"
> before running super().build() to do the 'make' calls.
>
> My snapcraft.yaml has one part that uses my plugin subclass.
>
> snapcraft build will (not always, but more often than not) pick the
> MakePlugin class instead, meaning that the build breaks because
> there's no Makefile generated.
>
> This is due to logic in pluginhandler.py, where _get_plugin() looks
> for the first thing in the vars(perlmake) dictionary that is a
> subclass of BasePlugin but isn't BasePlugin itself. This ends up
> sometimes being MakePlugin instead of my PerlMakePlugin. I need to
> import MakePlugin to subclass it, so this method of finding the plugin
> class isn't reliable.
>
> In my case I will just reimplement the rest of MakePlugin, but it
> might be worth fixing _get_plugin for future use. Perhaps we could
> allow a module-level variable like PLUGIN_CLASS, which I could set to
> PerlMakePlugin and _get_plugin could check that first, if it exists.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/snapcraft/+bug/1616656/+subscriptions
>