From d63bd7e9def528d3ed59a2798452ac1da58ebea4 Mon Sep 17 00:00:00 2001 From: Tristan Van Berkom Date: Fri, 24 Apr 2020 18:12:54 +0900 Subject: Plugin loading refactor, removing all versioning Plugin format versioning was decided to be removed for local plugins and any plugins for which we do not load an explicitly provided plugin. For pip, this will be handled with a standard distutils/setuptools approach, allowing users to specify pip style version boundaries in the plugin origins. This patch refactors plugin loading so that all related code goes into the private _pluginfactory module, a new small PluginOrigin type was added to better manipulate loaded origins. Test cases have been removed and will be readded in a following commit, adjusted to new expectations. --- .../badversionelement/customelements/__init__.py | 0 .../badversionelement/customelements/foo.py | 19 ------------------- .../badversionelement/elements/simple.bst | 4 ---- .../pluginloading/badversionelement/project.conf | 10 ---------- .../badversionsource/customsources/__init__.py | 0 .../badversionsource/customsources/foo.py | 16 ---------------- .../badversionsource/elements/simple.bst | 6 ------ .../pluginloading/badversionsource/project.conf | 10 ---------- .../pluginloading/customelement/project.conf | 2 +- .../internals/pluginloading/customsource/project.conf | 2 +- 10 files changed, 2 insertions(+), 67 deletions(-) delete mode 100644 tests/internals/pluginloading/badversionelement/customelements/__init__.py delete mode 100644 tests/internals/pluginloading/badversionelement/customelements/foo.py delete mode 100644 tests/internals/pluginloading/badversionelement/elements/simple.bst delete mode 100644 tests/internals/pluginloading/badversionelement/project.conf delete mode 100644 tests/internals/pluginloading/badversionsource/customsources/__init__.py delete mode 100644 tests/internals/pluginloading/badversionsource/customsources/foo.py delete mode 100644 tests/internals/pluginloading/badversionsource/elements/simple.bst delete mode 100644 tests/internals/pluginloading/badversionsource/project.conf (limited to 'tests/internals/pluginloading') diff --git a/tests/internals/pluginloading/badversionelement/customelements/__init__.py b/tests/internals/pluginloading/badversionelement/customelements/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/internals/pluginloading/badversionelement/customelements/foo.py b/tests/internals/pluginloading/badversionelement/customelements/foo.py deleted file mode 100644 index 75536e87f..000000000 --- a/tests/internals/pluginloading/badversionelement/customelements/foo.py +++ /dev/null @@ -1,19 +0,0 @@ -from buildstream import Element - - -class FooElement(Element): - - BST_FORMAT_VERSION = 5 - - def preflight(self): - pass - - def configure(self, node): - pass - - def get_unique_key(self): - return {} - - -def setup(): - return FooElement diff --git a/tests/internals/pluginloading/badversionelement/elements/simple.bst b/tests/internals/pluginloading/badversionelement/elements/simple.bst deleted file mode 100644 index f949dc5b5..000000000 --- a/tests/internals/pluginloading/badversionelement/elements/simple.bst +++ /dev/null @@ -1,4 +0,0 @@ -kind: foo -description: Custom foo element -config: - some: thing diff --git a/tests/internals/pluginloading/badversionelement/project.conf b/tests/internals/pluginloading/badversionelement/project.conf deleted file mode 100644 index bff73e251..000000000 --- a/tests/internals/pluginloading/badversionelement/project.conf +++ /dev/null @@ -1,10 +0,0 @@ -name: pony -min-version: 2.0 -element-path: elements - -plugins: -- origin: local - path: customelements - elements: - # We provided bar at version 5, should be a conflict. - foo: 10 diff --git a/tests/internals/pluginloading/badversionsource/customsources/__init__.py b/tests/internals/pluginloading/badversionsource/customsources/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/internals/pluginloading/badversionsource/customsources/foo.py b/tests/internals/pluginloading/badversionsource/customsources/foo.py deleted file mode 100644 index 628f99b29..000000000 --- a/tests/internals/pluginloading/badversionsource/customsources/foo.py +++ /dev/null @@ -1,16 +0,0 @@ -from buildstream import Source - - -class BarSource(Source): - - BST_FORMAT_VERSION = 5 - - def preflight(self): - pass - - def configure(self, node): - pass - - -def setup(): - return BarSource diff --git a/tests/internals/pluginloading/badversionsource/elements/simple.bst b/tests/internals/pluginloading/badversionsource/elements/simple.bst deleted file mode 100644 index 7e0cc43b7..000000000 --- a/tests/internals/pluginloading/badversionsource/elements/simple.bst +++ /dev/null @@ -1,6 +0,0 @@ -kind: autotools -description: Custom foo source -sources: -- kind: foo - ref: 1.2.3 - uri: http://ponyland.com diff --git a/tests/internals/pluginloading/badversionsource/project.conf b/tests/internals/pluginloading/badversionsource/project.conf deleted file mode 100644 index cd5b2dc82..000000000 --- a/tests/internals/pluginloading/badversionsource/project.conf +++ /dev/null @@ -1,10 +0,0 @@ -name: pony -min-version: 2.0 -element-path: elements - -plugins: -- origin: local - path: customsources - sources: - # We provided bar at version 5, should be a conflict. - foo: 10 diff --git a/tests/internals/pluginloading/customelement/project.conf b/tests/internals/pluginloading/customelement/project.conf index 6a33cc504..2619bdf82 100644 --- a/tests/internals/pluginloading/customelement/project.conf +++ b/tests/internals/pluginloading/customelement/project.conf @@ -5,4 +5,4 @@ plugins: - origin: local path: pluginelements elements: - foo: 0 + - foo diff --git a/tests/internals/pluginloading/customsource/project.conf b/tests/internals/pluginloading/customsource/project.conf index 87d9b5d09..5cb6da537 100644 --- a/tests/internals/pluginloading/customsource/project.conf +++ b/tests/internals/pluginloading/customsource/project.conf @@ -5,4 +5,4 @@ plugins: - origin: local path: pluginsources sources: - foo: 0 + - foo -- cgit v1.2.1