summaryrefslogtreecommitdiff
path: root/src/buildstream/_loader
diff options
context:
space:
mode:
authorBenjamin Schubert <ben.c.schubert@gmail.com>2019-06-25 17:51:36 +0100
committerbst-marge-bot <marge-bot@buildstream.build>2019-07-15 14:14:02 +0000
commita275c823f07fb6d737ba7288056abce1599eecec (patch)
treeed159afda3e837535c08d916577f615049d479f0 /src/buildstream/_loader
parentbb3c8045cd89a7c4d1d7cd2e03736496dd449fb9 (diff)
downloadbuildstream-a275c823f07fb6d737ba7288056abce1599eecec.tar.gz
_yaml: Remove 'node_del' and support `del mapping[key]`
- Also add a convenience method 'safe_del' catching the exception when we don't care if the value was there or not.
Diffstat (limited to 'src/buildstream/_loader')
-rw-r--r--src/buildstream/_loader/loader.py4
-rw-r--r--src/buildstream/_loader/types.pyx2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/buildstream/_loader/loader.py b/src/buildstream/_loader/loader.py
index 33a7762d1..750df40c9 100644
--- a/src/buildstream/_loader/loader.py
+++ b/src/buildstream/_loader/loader.py
@@ -471,12 +471,12 @@ class Loader():
for index, source in enumerate(sources):
kind = source.get_str(Symbol.KIND)
- _yaml.node_del(source, Symbol.KIND)
+ del source[Symbol.KIND]
# Directory is optional
directory = source.get_str(Symbol.DIRECTORY, default=None)
if directory:
- _yaml.node_del(source, Symbol.DIRECTORY)
+ del source[Symbol.DIRECTORY]
meta_source = MetaSource(element.name, index, element_kind, kind, source, directory)
meta_sources.append(meta_source)
diff --git a/src/buildstream/_loader/types.pyx b/src/buildstream/_loader/types.pyx
index dfd8f9046..3a415afc9 100644
--- a/src/buildstream/_loader/types.pyx
+++ b/src/buildstream/_loader/types.pyx
@@ -150,7 +150,7 @@ cdef void _extract_depends_from_node(_yaml.Node node, str key, str default_dep_t
acc.append(dependency)
# Now delete the field, we dont want it anymore
- _yaml.node_del(node, key, safe=True)
+ node.safe_del(key)
# extract_depends_from_node():