summaryrefslogtreecommitdiff
path: root/src/buildstream/_includes.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/_includes.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/_includes.py')
-rw-r--r--src/buildstream/_includes.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/buildstream/_includes.py b/src/buildstream/_includes.py
index 4c1eabb7e..678f24dba 100644
--- a/src/buildstream/_includes.py
+++ b/src/buildstream/_includes.py
@@ -43,7 +43,6 @@ class Includes:
else:
includes = includes_node.as_str_list()
- include_provenance = _yaml.node_get_provenance(node, key='(@)')
del node['(@)']
for include in reversed(includes):
@@ -53,6 +52,7 @@ class Includes:
include_node, file_path, sub_loader = self._include_file(include,
current_loader)
except LoadError as e:
+ include_provenance = includes_node.get_provenance()
if e.reason == LoadErrorReason.MISSING_FILE:
message = "{}: Include block references a file that could not be found: '{}'.".format(
include_provenance, include)
@@ -65,6 +65,7 @@ class Includes:
raise
if file_path in included:
+ include_provenance = includes_node.get_provenance()
raise LoadError(LoadErrorReason.RECURSIVE_INCLUDE,
"{}: trying to recursively include {}". format(include_provenance,
file_path))