Add API for composing lists in yaml nodes
Background
As part of #1061 we need to perform composition between lists like so:
# bar.bst
kind: autotools
dependencies:
(>):
- foo-lib.bst
# project.conf
elements:
autotools:
dependencies:
- autotools.bst
These lists are expected to be composed into this:
- autotools.bst
- foo-lib.bst
This means we need to do something along the lines of:
default_deps = _yaml.node_get(project_conf, list, "dependencies")
deps = _yaml.node_get(element, list, "dependencies")
_yaml.composite(default_deps, deps)
But this will not work, because _yaml.composite() will only deal with _yaml.Nodes.
Task description
We should add some form of an API to allow doing this - I can see either of these things working:
-
_yaml.composite()learns to deal with plain lists - the problem here is that we'd struggle providing provenance data, and the behavior ofcomposite(list, list)isn't obvious (although !1601 (merged) will probably make that "safe append", at least for dependencies). -
_yaml.get_node()returns proper_yaml.Nodes whentype=_yaml.Nodefor lists - this feels a bit more reasonable, but I'm likely overlooking something :)
Acceptance Criteria
We should be able to compose lists without creating naughty synthetic nodes.
Edited by Tristan Maat