diff options
author | Benjamin Schubert <contact@benschubert.me> | 2019-06-25 20:27:15 +0100 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2019-07-15 14:14:03 +0000 |
commit | 42d3d8406a15cd5f6f4a7d00e298dba019a50ed6 (patch) | |
tree | 7165dafdc3707faf4e71fba8c81d5752fd4668d8 /src/buildstream/_options | |
parent | ed2dde6110a5f9087ff3596df9d86ba5468dcac8 (diff) | |
download | buildstream-42d3d8406a15cd5f6f4a7d00e298dba019a50ed6.tar.gz |
_yaml: Introduce 'MappingNode.values()'
This is to mimic the 'dict.values()' interface.
- Adapt parts of the code calling 'node_items' but ignoring the
first value to use this instead
Diffstat (limited to 'src/buildstream/_options')
-rw-r--r-- | src/buildstream/_options/optionpool.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/buildstream/_options/optionpool.py b/src/buildstream/_options/optionpool.py index 23459d3c5..af0f99b97 100644 --- a/src/buildstream/_options/optionpool.py +++ b/src/buildstream/_options/optionpool.py @@ -185,10 +185,11 @@ class OptionPool(): # Now recurse into nested dictionaries and lists # and process any indirectly nested conditionals. # - for _, value in _yaml.node_items(node): - if _yaml.is_node(value): + for value in node.values(): + value_type = type(value) + if value_type is _yaml.MappingNode: self.process_node(value) - elif isinstance(value, list): + elif value_type is _yaml.SequenceNode: self._process_list(value) ####################################################### @@ -237,9 +238,10 @@ class OptionPool(): # def _process_list(self, values): for value in values: - if _yaml.is_node(value): + value_type = type(value) + if value_type is _yaml.MappingNode: self.process_node(value) - elif isinstance(value, list): + elif value_type is _yaml.SequenceNode: self._process_list(value) # Process a single conditional, resulting in composition |