diff options
author | Mathieu Bridon <bochecha@daitauha.fr> | 2017-12-08 12:51:41 +0100 |
---|---|---|
committer | Mathieu Bridon <bochecha@daitauha.fr> | 2017-12-12 17:59:43 +0100 |
commit | 1ebf9062c174e54ad3b946423a6dccc086a3f3a7 (patch) | |
tree | da9c3fd61c3618b1d9faff2553325e3d99beca5f | |
parent | ed9b827de06f012f6c7f576034fcbc3eb3e6231f (diff) | |
download | buildstream-optional-yaml-for-source-plugins.tar.gz |
plugincontext: Let plugins not have YAML defaultsoptional-yaml-for-source-plugins
Source plugins typically do not have an accompanying YAML file with
their default settings.
-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 3b82954ed..9bd3bf808 100644 --- a/buildstream/_plugincontext.py +++ b/buildstream/_plugincontext.py @@ -101,10 +101,14 @@ class PluginContext(): # Also load the defaults - required since setuptools # may need to extract the file. - defaults = plugin.dist.get_resource_filename( - pkg_resources._manager, - plugin.module_name.replace('.', os.sep) + '.yaml' - ) + try: + defaults = plugin.dist.get_resource_filename( + pkg_resources._manager, + plugin.module_name.replace('.', os.sep) + '.yaml' + ) + except KeyError: + # The plugin didn't have an accompanying YAML file + defaults = None # Set the plugin-base source to the setuptools directory source = self.plugin_base.make_plugin_source(searchpath=[os.path.dirname(location)]) |