Re: How to properly import a plugin?



On 15/08/17 10:11, Sam Thursfield wrote:
By design, elements from the plugins/ module can't be extended in Python code.

Hmm, seems I spoke to soon on this. The following does actually appear to work:

```
from . import dpkg_build

# Element implementation for the 'my_dpkg_build' kind.
class MyDpkgElement(dpkg_build.DpkgElement):
      pass

# Plugin entry point
def setup():
    return MyDpkgElement
```

I still think that we want to avoid this sort of thing if possible, but I guess we need to wait for Tristan to return in order to clarify.

Sam


--
Sam Thursfield, Codethink Ltd.
Office telephone: +44 161 236 5575


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]