summaryrefslogtreecommitdiff
path: root/src/buildstream/_context.py
diff options
context:
space:
mode:
authorBenjamin Schubert <contact@benschubert.me>2019-07-08 14:18:39 +0100
committerbst-marge-bot <marge-bot@buildstream.build>2019-07-15 14:14:03 +0000
commit099e3ebf3aad424be2f3488aef9d9d961b700483 (patch)
treeb1634644122751537e092caf8c35f8a1cee6cf9b /src/buildstream/_context.py
parent695eddc069c9803eca5d004e80ca7be7defdd20c (diff)
downloadbuildstream-099e3ebf3aad424be2f3488aef9d9d961b700483.tar.gz
_yaml: Remove 'node_get_provenance' and add 'Node.get_provenance'
This replaces the helper method by adding a 'get_provenance' on the node directly - Adapt all call sites - Delay getting provenance wherever possible without major refactor
Diffstat (limited to 'src/buildstream/_context.py')
-rw-r--r--src/buildstream/_context.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/buildstream/_context.py b/src/buildstream/_context.py
index 9cb4f5943..2243192b3 100644
--- a/src/buildstream/_context.py
+++ b/src/buildstream/_context.py
@@ -507,9 +507,10 @@ class Context():
# LoadError, when the value is not of the expected type, or is not found.
#
def _node_get_option_str(node, key, allowed_options):
- result = node.get_str(key)
+ result_node = node.get_scalar(key)
+ result = result_node.as_str()
if result not in allowed_options:
- provenance = _yaml.node_get_provenance(node, key)
+ provenance = result_node.get_provenance()
raise LoadError(LoadErrorReason.INVALID_DATA,
"{}: {} should be one of: {}".format(
provenance, key, ", ".join(allowed_options)))