diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2018-09-02 17:49:00 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2018-09-02 18:36:49 +0900 |
commit | 16462e9cd2007ae9e90fd94a7af5ba4c142cf83e (patch) | |
tree | 93c8eb07ff9e4689aa6b9acf63fc56f9c9ba75ab /buildstream/plugin.py | |
parent | 43ad22d7509acba0fde011798a2271da7ad72215 (diff) | |
download | buildstream-16462e9cd2007ae9e90fd94a7af5ba4c142cf83e.tar.gz |
plugin.py: Added _configure() and _get_configuring() private APIs
Keeps track of whether the plugin is currently being configured.
Adjusted Element and Source classes to call _configure() in place
of calling configure() directly.
This is a part of #620
Diffstat (limited to 'buildstream/plugin.py')
-rw-r--r-- | buildstream/plugin.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/buildstream/plugin.py b/buildstream/plugin.py index a65db4d42..d8cca2751 100644 --- a/buildstream/plugin.py +++ b/buildstream/plugin.py @@ -179,6 +179,7 @@ class Plugin(): self.__provenance = provenance # The Provenance information self.__type_tag = type_tag # The type of plugin (element or source) self.__unique_id = _plugin_register(self) # Unique ID + self.__configuring = False # Whether we are currently configuring # Infer the kind identifier modulename = type(self).__module__ @@ -682,7 +683,32 @@ class Plugin(): else: yield log + # _configure(): + # + # Calls configure() for the plugin, this must be called by + # the core instead of configure() directly, so that the + # _get_configuring() state is up to date. + # + # Args: + # node (dict): The loaded configuration dictionary + # + def _configure(self, node): + self.__configuring = True + self.configure(node) + self.__configuring = False + + # _get_configuring(): + # + # Checks whether the plugin is in the middle of having + # its Plugin.configure() method called + # + # Returns: + # (bool): Whether we are currently configuring + def _get_configuring(self): + return self.__configuring + # _preflight(): + # # Calls preflight() for the plugin, and allows generic preflight # checks to be added # @@ -690,6 +716,7 @@ class Plugin(): # SourceError: If it's a Source implementation # ElementError: If it's an Element implementation # ProgramNotFoundError: If a required host tool is not found + # def _preflight(self): self.preflight() |