diff options
author | Mathieu Bridon <bochecha@daitauha.fr> | 2017-12-08 12:51:41 +0100 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2017-12-14 06:52:41 +0100 |
commit | c84b836c47f108ff52bae8b6f613f26c96413366 (patch) | |
tree | 93785fee1181958a79314cccc3583160e84ef352 /buildstream/_plugincontext.py | |
parent | 7d1124e5361ebfa9612d10f3d93f4d81677c7f48 (diff) | |
download | buildstream-c84b836c47f108ff52bae8b6f613f26c96413366.tar.gz |
_plugincontext.py: Let plugins not have YAML defaults
Source plugins typically do not have an accompanying YAML file with
their default settings.
Diffstat (limited to 'buildstream/_plugincontext.py')
-rw-r--r-- | buildstream/_plugincontext.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/buildstream/_plugincontext.py b/buildstream/_plugincontext.py index f81dff67c..1759333e1 100644 --- a/buildstream/_plugincontext.py +++ b/buildstream/_plugincontext.py @@ -99,10 +99,14 @@ class PluginContext(): # Also load the defaults - required since setuptools # may need to extract the file. - defaults = package.dist.get_resource_filename( - pkg_resources._manager, - package.module_name.replace('.', os.sep) + '.yaml' - ) + try: + defaults = package.dist.get_resource_filename( + pkg_resources._manager, + package.module_name.replace('.', os.sep) + '.yaml' + ) + except KeyError: + # The plugin didn't have an accompanying YAML file + defaults = None source = self.plugin_base.make_plugin_source(searchpath=[os.path.dirname(location)]) self.alternate_sources[('pip', package_name)] = source |