Bug #1547681 “in snapcraft plugin, direct import of BaseHandler ...” : Bugs : Snapcraft

in snapcraft plugin, direct import of BaseHandler causes problems

Bug #1547681 reported by Chad Miller
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
Fix Released
Medium
Sergio Schvezov

Bug Description

The pluginhandler code searches module attrs for a value that is the likely plugin class.

If a user writes the plugin from scratch, they are likely to

"from snapcraft import BaseHandler" so they can later extend BaseHandler in their class.

About half the time, the pluginhandler iteration over module contents will find BaseHandler first and think it is the local code that is supposed to be the plugin implementation.

The pluginhandler "_get_plugin" function should test whether the value they are on is not BaseHandler before nominating it as the plugin.

Probably

if isinstance(attr, type) and issubclass(attr, snapcraft.BasePlugin) and attr != snapcraft.BasePlugin: ...

Chad Miller (cmiller)
summary: - in plugin handler import of BaseHandler causes problems
+ in snapcraft plugin, direct import of BaseHandler causes problems
Changed in snapcraft:
importance: Undecided → Medium
status: New → Triaged
milestone: none → next
assignee: nobody → Sergio Schvezov (sergiusens)
Revision history for this message
Sergio Schvezov (sergiusens) wrote :
Changed in snapcraft:
status: Triaged → In Progress
Changed in snapcraft:
status: In Progress → Fix Committed
Changed in snapcraft:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Loading subscribers...

Remote bug watches

Bug watches keep track of this bug in other bug trackers.