diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2020-05-03 13:24:30 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2020-05-04 19:35:15 +0900 |
commit | 15169826257e2741df09488a52e7ed27fa2661d4 (patch) | |
tree | e62707f140dfb6e31335ec347ef7b43f1a0475a1 /tests | |
parent | 22117146f9f1881ab88ae2161707e92b4dc217fd (diff) | |
download | buildstream-15169826257e2741df09488a52e7ed27fa2661d4.tar.gz |
tests/plugins/pip-samples/sample-plugins: Adding a sample pip plugins package
This commit:
* Adds a bare bones BuildStream pip plugin package structure at
tests/plugins/pip-samples/sample-plugins
* setup.cfg: Adds tests/plugins/pip-samples to the norecursedirs so that
we don't consider the dummy plugins as test code
Diffstat (limited to 'tests')
7 files changed, 92 insertions, 0 deletions
diff --git a/tests/plugins/sample-plugins/setup.py b/tests/plugins/sample-plugins/setup.py new file mode 100755 index 000000000..8429c7cd7 --- /dev/null +++ b/tests/plugins/sample-plugins/setup.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2020 Codethink Limited +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library. If not, see <http://www.gnu.org/licenses/>. +# + +from setuptools import setup, find_packages + +setup( + name="sample-plugins", + version="1.2.3", + description="A collection of sample plugins for testing.", + license="LGPL", + url="https://example.com/sample-plugins", + package_dir={"": "src"}, + packages=find_packages(where="src"), + include_package_data=True, + entry_points={ + "buildstream.plugins.elements": ["sample = sample_plugins.elements.sample",], + "buildstream.plugins.sources": ["sample = sample_plugins.sources.sample",], + }, + zip_safe=False, +) +# eof setup() diff --git a/tests/plugins/sample-plugins/src/sample_plugins/__init__.py b/tests/plugins/sample-plugins/src/sample_plugins/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/plugins/sample-plugins/src/sample_plugins/__init__.py diff --git a/tests/plugins/sample-plugins/src/sample_plugins/elements/__init__.py b/tests/plugins/sample-plugins/src/sample_plugins/elements/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/plugins/sample-plugins/src/sample_plugins/elements/__init__.py diff --git a/tests/plugins/sample-plugins/src/sample_plugins/elements/sample.py b/tests/plugins/sample-plugins/src/sample_plugins/elements/sample.py new file mode 100644 index 000000000..590e99ee8 --- /dev/null +++ b/tests/plugins/sample-plugins/src/sample_plugins/elements/sample.py @@ -0,0 +1,19 @@ +from buildstream import Element + + +class Sample(Element): + BST_MIN_VERSION = "2.0" + + def configure(self, node): + pass + + def preflight(self): + pass + + def get_unique_key(self): + return {} + + +# Plugin entry point +def setup(): + return Sample diff --git a/tests/plugins/sample-plugins/src/sample_plugins/elements/sample.yaml b/tests/plugins/sample-plugins/src/sample_plugins/elements/sample.yaml new file mode 100644 index 000000000..956ad14d4 --- /dev/null +++ b/tests/plugins/sample-plugins/src/sample_plugins/elements/sample.yaml @@ -0,0 +1,5 @@ +# Set a variable so that we can test that the yaml +# was actually loaded using bst show. +# +variables: + sample-loaded: True diff --git a/tests/plugins/sample-plugins/src/sample_plugins/sources/__init__.py b/tests/plugins/sample-plugins/src/sample_plugins/sources/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/plugins/sample-plugins/src/sample_plugins/sources/__init__.py diff --git a/tests/plugins/sample-plugins/src/sample_plugins/sources/sample.py b/tests/plugins/sample-plugins/src/sample_plugins/sources/sample.py new file mode 100644 index 000000000..968a0e342 --- /dev/null +++ b/tests/plugins/sample-plugins/src/sample_plugins/sources/sample.py @@ -0,0 +1,32 @@ +from buildstream import Source + + +class Sample(Source): + BST_MIN_VERSION = "2.0" + + def configure(self, node): + pass + + def preflight(self): + pass + + def get_unique_key(self): + return {} + + def load_ref(self, node): + pass + + def get_ref(self): + return {} + + def set_ref(self, ref, node): + pass + + def is_cached(self): + return False + + +# Plugin entry point +def setup(): + + return Sample |