How to properly import a plugin?



Hello,

I was trying to extend one of the Element Plugins but ran into an issue quite early on. I'm hoping that someone on this list might have some answers.

I was trying to naively extend a plugin (DpkgElement specifically) like so:

```
from buildstream.plugins.elements.dpkg_build import DpkgElement

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

```

While the above import statement worked successfully when I was trying it out in a python shell, it doesn't seem to work when it is run as part of the `bst build` command. Upon doing that, I get an error message like so (truncated):

```
...

  File "/usr/local/lib/python3.5/dist-packages/pluginbase.py", line 410, in plugin_import
    fromlist, level)
  File "/src/plugins/elements/bb_dpkg_build.py", line 1, in <module>
    from buildstream.plugins.elements.dpkg_build import DpkgElement
  File "/usr/local/lib/python3.5/dist-packages/pluginbase.py", line 410, in plugin_import
    fromlist, level)
ImportError: No module named 'pluginbase._internalspace._sp606628c88e67eb4efbaa8e0085714209.elements'
```

Is there another way of importing plugins correctly, or is it something that works as designed and plugins are not supposed to be imported?

--
Regards,
Chandan Singh


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