From 5f85e13108bda52c2db6d9c7b4555c31a83cfff8 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Wed, 15 May 2019 15:36:28 +0100 Subject: element.py: Lift __extract_variables to be classmethod Since __extract_variables only needs to be a class method, lift it to clarify what it depends on. Signed-off-by: Daniel Silverstone --- buildstream/element.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/buildstream/element.py b/buildstream/element.py index 31f3c83a4..1190b0ed0 100644 --- a/buildstream/element.py +++ b/buildstream/element.py @@ -245,7 +245,7 @@ class Element(Plugin): self.__init_defaults(project, plugin_conf, self.get_kind()) # Collect the composited variables and resolve them - variables = self.__extract_variables(meta) + variables = self.__extract_variables(project, meta) _yaml.node_set(variables, 'element-name', self.name) self.__variables = Variables(variables) @@ -2518,11 +2518,11 @@ class Element(Plugin): # This will resolve the final variables to be used when # substituting command strings to be run in the sandbox # - def __extract_variables(self, meta): - default_vars = _yaml.node_get(self.__defaults, Mapping, 'variables', + @classmethod + def __extract_variables(cls, project, meta): + default_vars = _yaml.node_get(cls.__defaults, Mapping, 'variables', default_value={}) - project = self._get_project() if meta.kind == "junction": variables = _yaml.node_copy(project.first_pass_config.base_variables) else: -- cgit v1.2.1