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/_sourcefactory.py | |
parent | 483b0223bccad8c4c843d445f6621eefe2000744 (diff) | |
download | buildstream-19cd954bf9e22cbd6b7adacc9d87a693811830dc.tar.gz |
Refactor plugin factory creation
Diffstat (limited to 'buildstream/_sourcefactory.py')
-rw-r--r-- | buildstream/_sourcefactory.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/buildstream/_sourcefactory.py b/buildstream/_sourcefactory.py index 88a130e10..1d959a140 100644 --- a/buildstream/_sourcefactory.py +++ b/buildstream/_sourcefactory.py @@ -31,9 +31,13 @@ from .source import Source # class SourceFactory(PluginContext): - def __init__(self, plugin_base, plugin_origins=None): + def __init__(self, plugin_base, *, + format_versions={}, + plugin_origins=None): - super().__init__(plugin_base, Source, [_site.source_plugins], plugin_origins) + super().__init__(plugin_base, Source, [_site.source_plugins], + format_versions=format_versions, + plugin_origins=plugin_origins) # create(): # @@ -54,4 +58,7 @@ class SourceFactory(PluginContext): # def create(self, context, project, meta): source_type, _ = self.lookup(meta.kind) - return source_type(context, project, meta) + source = source_type(context, project, meta) + version = self._format_versions.get(meta.kind, 0) + self._assert_plugin_format(source, version) + return source |