diff options
-rw-r--r-- | src/buildstream/_options/option.py | 3 | ||||
-rw-r--r-- | src/buildstream/_options/optionbool.py | 7 | ||||
-rw-r--r-- | src/buildstream/_options/optionenum.py | 7 | ||||
-rw-r--r-- | src/buildstream/_options/optionflags.py | 8 | ||||
-rw-r--r-- | src/buildstream/_options/optionpool.py | 4 | ||||
-rw-r--r-- | src/buildstream/_project.py | 2 |
6 files changed, 10 insertions, 21 deletions
diff --git a/src/buildstream/_options/option.py b/src/buildstream/_options/option.py index 71d2f12f3..5c0eb5063 100644 --- a/src/buildstream/_options/option.py +++ b/src/buildstream/_options/option.py @@ -76,9 +76,8 @@ class Option: # Args: # node (Mapping): The YAML loaded key/value dictionary # to load the value from - # transform (callbable): Transform function for variable substitution # - def load_value(self, node, *, transform=None): + def load_value(self, node): pass # pragma: nocover # set_value() diff --git a/src/buildstream/_options/optionbool.py b/src/buildstream/_options/optionbool.py index f6159825c..57dbd160e 100644 --- a/src/buildstream/_options/optionbool.py +++ b/src/buildstream/_options/optionbool.py @@ -36,11 +36,8 @@ class OptionBool(Option): node.validate_keys(OPTION_SYMBOLS + ["default"]) self.value = node.get_bool("default") - def load_value(self, node, *, transform=None): - if transform: - self.set_value(transform(node.get_scalar(self.name))) - else: - self.value = node.get_bool(self.name) + def load_value(self, node): + self.value = node.get_bool(self.name) def set_value(self, value): if value in ("True", "true"): diff --git a/src/buildstream/_options/optionenum.py b/src/buildstream/_options/optionenum.py index 12ec7cb63..da3a7dc7e 100644 --- a/src/buildstream/_options/optionenum.py +++ b/src/buildstream/_options/optionenum.py @@ -58,12 +58,9 @@ class OptionEnum(Option): # Allow subclass to define the default value self.value = self.load_default_value(node) - def load_value(self, node, *, transform=None): + def load_value(self, node): value_node = node.get_scalar(self.name) - if transform: - self.value = transform(value_node) - else: - self.value = value_node.as_str() + self.value = value_node.as_str() self.validate(self.value, value_node) diff --git a/src/buildstream/_options/optionflags.py b/src/buildstream/_options/optionflags.py index b19a22738..042ef644c 100644 --- a/src/buildstream/_options/optionflags.py +++ b/src/buildstream/_options/optionflags.py @@ -60,13 +60,9 @@ class OptionFlags(Option): self.value = value_node.as_str_list() self.validate(self.value, value_node) - def load_value(self, node, *, transform=None): + def load_value(self, node): value_node = node.get_sequence(self.name) - if transform: - self.value = [transform(x) for x in value_node] - else: - self.value = value_node.as_str_list() - self.value = sorted(self.value) + self.value = sorted(value_node.as_str_list()) self.validate(self.value, value_node) def set_value(self, value): diff --git a/src/buildstream/_options/optionpool.py b/src/buildstream/_options/optionpool.py index dee038f0b..c05c55914 100644 --- a/src/buildstream/_options/optionpool.py +++ b/src/buildstream/_options/optionpool.py @@ -104,7 +104,7 @@ class OptionPool: # Args: # node (dict): The loaded YAML options # - def load_yaml_values(self, node, *, transform=None): + def load_yaml_values(self, node): for option_name, option_value in node.items(): try: option = self._options[option_name] @@ -113,7 +113,7 @@ class OptionPool: raise LoadError( "{}: Unknown option '{}' specified".format(p, option_name), LoadErrorReason.INVALID_DATA ) from e - option.load_value(node, transform=transform) + option.load_value(node) # load_cli_values() # diff --git a/src/buildstream/_project.py b/src/buildstream/_project.py index b8d34c862..06c677051 100644 --- a/src/buildstream/_project.py +++ b/src/buildstream/_project.py @@ -836,7 +836,7 @@ class Project: output.options.load(options_node) if self.junction: # load before user configuration - output.options.load_yaml_values(self.junction.options, transform=lambda n: n.as_str()) + output.options.load_yaml_values(self.junction.options) # Collect option values specified in the user configuration overrides = self._context.get_overrides(self.name) |