summaryrefslogtreecommitdiff
path: root/src/buildstream/_project.py
diff options
context:
space:
mode:
authorBenjamin Schubert <contact@benschubert.me>2019-06-25 20:00:25 +0100
committerbst-marge-bot <marge-bot@buildstream.build>2019-07-15 14:14:03 +0000
commited2dde6110a5f9087ff3596df9d86ba5468dcac8 (patch)
tree180e7b0b4a38c28291541b1fde5f88890361e16c /src/buildstream/_project.py
parenta275c823f07fb6d737ba7288056abce1599eecec (diff)
downloadbuildstream-ed2dde6110a5f9087ff3596df9d86ba5468dcac8.tar.gz
_yaml: Remove 'node_keys' and add 'MappingNode.keys' to replace it
This mimics the dict.keys() method but returns a list instead of a dict_keys, for cython performance reasons
Diffstat (limited to 'src/buildstream/_project.py')
-rw-r--r--src/buildstream/_project.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/buildstream/_project.py b/src/buildstream/_project.py
index e1e873858..e5c0ad21a 100644
--- a/src/buildstream/_project.py
+++ b/src/buildstream/_project.py
@@ -714,7 +714,7 @@ class Project():
# Perform environment expansion right away
shell_environment = shell_options.get_mapping('environment', default={})
- for key in _yaml.node_keys(shell_environment):
+ for key in shell_environment.keys():
value = shell_environment.get_str(key)
self._shell_environment[key] = os.path.expandvars(value)
@@ -887,7 +887,7 @@ class Project():
# Store source versions for checking later
source_versions = origin.get_mapping('sources', default={})
- for key in _yaml.node_keys(source_versions):
+ for key in source_versions.keys():
if key in source_format_versions:
raise LoadError(
LoadErrorReason.INVALID_YAML,
@@ -896,7 +896,7 @@ class Project():
# Store element versions for checking later
element_versions = origin.get_mapping('elements', default={})
- for key in _yaml.node_keys(element_versions):
+ for key in element_versions.keys():
if key in element_format_versions:
raise LoadError(
LoadErrorReason.INVALID_YAML,
@@ -936,11 +936,10 @@ class Project():
raise LoadError(LoadErrorReason.INVALID_DATA,
"Unexpected plugin group: {}, expecting {}"
.format(plugin_group, expected_groups))
- node_keys = [key for key in _yaml.node_keys(origin)]
- if plugin_group in node_keys:
+ if plugin_group in origin.keys():
origin_node = origin.copy()
plugins = origin.get_mapping(plugin_group, default={})
- _yaml.node_set(origin_node, 'plugins', [k for k in _yaml.node_keys(plugins)])
+ _yaml.node_set(origin_node, 'plugins', plugins.keys())
for group in expected_groups:
if group in origin_node:
del origin_node[group]