summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChandan Singh <chandan@chandansingh.net>2020-01-14 22:40:05 +0000
committerChandan Singh <chandan@chandansingh.net>2020-01-17 15:50:51 +0000
commitb4d472e9c20c7c664b9f70ac242ab1a8bbd28749 (patch)
tree78c605320f5d7e4013814047b791d8277ddacdca
parent9a6c7d76324b70d020a8d34d2feef7f0ba2b5a0b (diff)
downloadbuildstream-b4d472e9c20c7c664b9f70ac242ab1a8bbd28749.tar.gz
Plugins: Update entrypoint group for pip origin
As discussed in https://mail.gnome.org/archives/buildstream-list/2020-January/msg00001.html, separate the entry point groups for elements and sources. Previously, both used `buildstream.plugins` which meant that it wasn't possible to have an element and a source plugin with the same name, when using `pip` origin. This a breaking change for all plugins, but will only affect projects using the `pip` plugin origin. As part of this, also bump the version of bst-plugins-experimental used in our tests to avoid CI breakages.
-rw-r--r--src/buildstream/_elementfactory.py1
-rw-r--r--src/buildstream/_plugincontext.py8
-rw-r--r--src/buildstream/_sourcefactory.py7
-rw-r--r--tox.ini2
4 files changed, 14 insertions, 4 deletions
diff --git a/src/buildstream/_elementfactory.py b/src/buildstream/_elementfactory.py
index 5d219c627..89e01a885 100644
--- a/src/buildstream/_elementfactory.py
+++ b/src/buildstream/_elementfactory.py
@@ -36,6 +36,7 @@ class ElementFactory(PluginContext):
plugin_base,
Element,
[_site.element_plugins],
+ "buildstream.plugins.elements",
plugin_origins=plugin_origins,
format_versions=format_versions,
)
diff --git a/src/buildstream/_plugincontext.py b/src/buildstream/_plugincontext.py
index 54839e16b..295482574 100644
--- a/src/buildstream/_plugincontext.py
+++ b/src/buildstream/_plugincontext.py
@@ -30,6 +30,7 @@ from . import utils
# plugin_base (PluginBase): The main PluginBase object to work with
# base_type (type): A base object type for this context
# site_plugin_path (str): Path to where buildstream keeps plugins
+# entrypoint_group (str): Name of the entry point group that provides plugins
# plugin_origins (list): Data used to search for plugins
# format_versions (dict): A dict of meta.kind to the integer minimum
# version number for each plugin to be loaded
@@ -42,7 +43,9 @@ from . import utils
# Pipelines.
#
class PluginContext:
- def __init__(self, plugin_base, base_type, site_plugin_path, *, plugin_origins=None, format_versions={}):
+ def __init__(
+ self, plugin_base, base_type, site_plugin_path, entrypoint_group, *, plugin_origins=None, format_versions={}
+ ):
# For pickling across processes, make sure this context has a unique
# identifier, which we prepend to the identifier of each PluginSource.
@@ -63,6 +66,7 @@ class PluginContext:
# The PluginSource object
self._plugin_base = plugin_base
self._site_plugin_path = site_plugin_path
+ self._entrypoint_group = entrypoint_group
self._alternate_sources = {}
self._format_versions = format_versions
@@ -147,7 +151,7 @@ class PluginContext:
# key by a tuple to avoid collision
try:
- package = pkg_resources.get_entry_info(package_name, "buildstream.plugins", kind)
+ package = pkg_resources.get_entry_info(package_name, self._entrypoint_group, kind)
except pkg_resources.DistributionNotFound as e:
raise PluginError("Failed to load {} plugin '{}': {}".format(self._base_type.__name__, kind, e)) from e
diff --git a/src/buildstream/_sourcefactory.py b/src/buildstream/_sourcefactory.py
index 7c90042a8..254c482d6 100644
--- a/src/buildstream/_sourcefactory.py
+++ b/src/buildstream/_sourcefactory.py
@@ -33,7 +33,12 @@ class SourceFactory(PluginContext):
def __init__(self, plugin_base, *, format_versions={}, plugin_origins=None):
super().__init__(
- plugin_base, Source, [_site.source_plugins], format_versions=format_versions, plugin_origins=plugin_origins
+ plugin_base,
+ Source,
+ [_site.source_plugins],
+ "buildstream.plugins.sources",
+ format_versions=format_versions,
+ plugin_origins=plugin_origins,
)
# create():
diff --git a/tox.ini b/tox.ini
index efb91e75b..30075ee8e 100644
--- a/tox.ini
+++ b/tox.ini
@@ -8,7 +8,7 @@ isolated_build = true
# Configuration variables to share across environments
[config]
-BST_PLUGINS_EXPERIMENTAL_VERSION = 0.14.0
+BST_PLUGINS_EXPERIMENTAL_VERSION = 0.15.0
#
# Defaults for all environments