diff options
author | Valentin David <valentin.david@codethink.co.uk> | 2018-07-18 11:37:31 +0200 |
---|---|---|
committer | Valentin David <valentin.david@codethink.co.uk> | 2018-08-02 16:17:01 +0200 |
commit | 19cd954bf9e22cbd6b7adacc9d87a693811830dc (patch) | |
tree | 07eec4174828f3e15821298e920ae91045f0c4c1 /buildstream/_elementfactory.py | |
parent | 483b0223bccad8c4c843d445f6621eefe2000744 (diff) | |
download | buildstream-19cd954bf9e22cbd6b7adacc9d87a693811830dc.tar.gz |
Refactor plugin factory creation
Diffstat (limited to 'buildstream/_elementfactory.py')
-rw-r--r-- | buildstream/_elementfactory.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/buildstream/_elementfactory.py b/buildstream/_elementfactory.py index 9d5b258cb..00847e66f 100644 --- a/buildstream/_elementfactory.py +++ b/buildstream/_elementfactory.py @@ -31,9 +31,13 @@ from .element import Element # class ElementFactory(PluginContext): - def __init__(self, plugin_base, plugin_origins=None): + def __init__(self, plugin_base, *, + format_versions={}, + plugin_origins=None): - super().__init__(plugin_base, Element, [_site.element_plugins], plugin_origins) + super().__init__(plugin_base, Element, [_site.element_plugins], + plugin_origins=plugin_origins, + format_versions=format_versions) # create(): # @@ -54,4 +58,7 @@ class ElementFactory(PluginContext): # def create(self, context, project, artifacts, meta): element_type, default_config = self.lookup(meta.kind) - return element_type(context, project, artifacts, meta, default_config) + element = element_type(context, project, artifacts, meta, default_config) + version = self._format_versions.get(meta.kind, 0) + self._assert_plugin_format(element, version) + return element |