diff options
author | Benjamin Schubert <contact@benschubert.me> | 2019-07-08 14:18:39 +0100 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2019-07-15 14:14:03 +0000 |
commit | 099e3ebf3aad424be2f3488aef9d9d961b700483 (patch) | |
tree | b1634644122751537e092caf8c35f8a1cee6cf9b /src/buildstream/_loader | |
parent | 695eddc069c9803eca5d004e80ca7be7defdd20c (diff) | |
download | buildstream-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/_loader')
-rw-r--r-- | src/buildstream/_loader/loader.py | 2 | ||||
-rw-r--r-- | src/buildstream/_loader/types.pyx | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/buildstream/_loader/loader.py b/src/buildstream/_loader/loader.py index e45381fbf..27975dc34 100644 --- a/src/buildstream/_loader/loader.py +++ b/src/buildstream/_loader/loader.py @@ -463,7 +463,7 @@ class Loader(): return meta_element node = element.node - elt_provenance = _yaml.node_get_provenance(node) + elt_provenance = node.get_provenance() meta_sources = [] sources = node.get_sequence(Symbol.SOURCES, default=[]) diff --git a/src/buildstream/_loader/types.pyx b/src/buildstream/_loader/types.pyx index cd206cfb4..fe1cea789 100644 --- a/src/buildstream/_loader/types.pyx +++ b/src/buildstream/_loader/types.pyx @@ -69,7 +69,7 @@ cdef class Dependency: str default_dep_type=None): cdef str dep_type - self.provenance = _yaml.node_get_provenance(dep) + self.provenance = dep.get_provenance() if type(dep) is _yaml.ScalarNode: self.name = dep.as_str() @@ -88,7 +88,7 @@ cdef class Dependency: if dep_type is None or dep_type == <str> Symbol.ALL: dep_type = None elif dep_type not in [Symbol.BUILD, Symbol.RUNTIME]: - provenance = _yaml.node_get_provenance(dep, key=Symbol.TYPE) + provenance = dep.get_scalar(Symbol.TYPE).get_provenance() raise LoadError(LoadErrorReason.INVALID_DATA, "{}: Dependency type '{}' is not 'build', 'runtime' or 'all'" .format(provenance, dep_type)) |