From f05f91725db54c62f79be11ea890f1ed5556db00 Mon Sep 17 00:00:00 2001 From: Benjamin Schubert Date: Wed, 3 Jul 2019 10:28:50 +0100 Subject: _yaml: Add a 'from_dict' on Node to create new nodes from dicts This new methods is here to replace the previous 'new_node_from_dict' that will be moved to a private method. Adapt all call sites to use the new 'from_dict' method. --- src/buildstream/_yaml.pyx | 4 ++++ src/buildstream/element.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/buildstream/_yaml.pyx b/src/buildstream/_yaml.pyx index 6420474eb..a142fdfcb 100644 --- a/src/buildstream/_yaml.pyx +++ b/src/buildstream/_yaml.pyx @@ -69,6 +69,10 @@ cdef class Node: self.line = line self.column = column + @classmethod + def from_dict(cls, dict value): + return new_node_from_dict(value) + cdef bint _walk_find(self, Node target, list path) except *: raise NotImplementedError() diff --git a/src/buildstream/element.py b/src/buildstream/element.py index a4496e192..770f5df42 100644 --- a/src/buildstream/element.py +++ b/src/buildstream/element.py @@ -2633,7 +2633,7 @@ class Element(Plugin): @classmethod def __extract_sandbox_config(cls, project, meta): if meta.is_junction: - sandbox_config = _yaml.new_node_from_dict({ + sandbox_config = _yaml.Node.from_dict({ 'build-uid': 0, 'build-gid': 0 }) -- cgit v1.2.1