diff options
author | Benjamin Schubert <contact@benschubert.me> | 2020-05-12 12:11:48 +0000 |
---|---|---|
committer | Benjamin Schubert <contact@benschubert.me> | 2020-05-12 14:45:42 +0000 |
commit | 1ff22fb98d58f1264a2af0650e40dcaaaa99dabc (patch) | |
tree | 5f7d53fc951ed1979a67b6d7a106c48d8e7bd2d4 | |
parent | 011f591b79e3a4def535ac829c3d885707381133 (diff) | |
download | buildstream-1ff22fb98d58f1264a2af0650e40dcaaaa99dabc.tar.gz |
source.py: Don't re-declare __init__ in source implementations
We explicitely ask plugin authors not to do this in our documentation,
we should therefore also not do it unless there is a real need.
For this cases, just pass the default values as class variables.
-rw-r--r-- | src/buildstream/plugins/sources/local.py | 6 | ||||
-rw-r--r-- | src/buildstream/plugins/sources/workspace.py | 15 |
2 files changed, 7 insertions, 14 deletions
diff --git a/src/buildstream/plugins/sources/local.py b/src/buildstream/plugins/sources/local.py index c39e09417..ffcae4993 100644 --- a/src/buildstream/plugins/sources/local.py +++ b/src/buildstream/plugins/sources/local.py @@ -49,11 +49,7 @@ class LocalSource(Source): BST_STAGE_VIRTUAL_DIRECTORY = True BST_KEY_REQUIRES_STAGE = True - def __init__(self, context, project, meta): - super().__init__(context, project, meta) - - # Cached unique key to avoid multiple file system traversal if the unique key is requested multiple times. - self.__unique_key = None + __unique_key = None def configure(self, node): node.validate_keys(["path", *Source.COMMON_CONFIG_KEYS]) diff --git a/src/buildstream/plugins/sources/workspace.py b/src/buildstream/plugins/sources/workspace.py index 796f2b3d9..f1d965fa0 100644 --- a/src/buildstream/plugins/sources/workspace.py +++ b/src/buildstream/plugins/sources/workspace.py @@ -51,15 +51,12 @@ class WorkspaceSource(Source): BST_STAGE_VIRTUAL_DIRECTORY = True BST_KEY_REQUIRES_STAGE = True - def __init__(self, context, project, meta) -> None: - super().__init__(context, project, meta) - - # Cached unique key - self.__unique_key = None - # the digest of the Directory following the import of the workspace - self.__digest = None - # the cache key of the last workspace build - self.__last_build = None + # Cached unique key + __unique_key = None + # the digest of the Directory following the import of the workspace + __digest = None + # the cache key of the last workspace build + __last_build = None def track(self) -> SourceRef: # pylint: disable=arguments-differ return None |