specs: add convenience function for reading spec dependencies from node dict

This commit is contained in:
Peter Josef Scheibel 2018-05-18 16:15:57 -07:00 committed by Todd Gamblin
parent 4daa164fbf
commit acdb391931

View File

@ -1558,6 +1558,15 @@ def from_node_dict(node):
return spec return spec
@staticmethod
def dependencies_from_node_dict(node):
name = next(iter(node))
node = node[name]
if 'dependencies' not in node:
return
for t in Spec.read_yaml_dep_specs(node['dependencies']):
yield t
@staticmethod @staticmethod
def read_yaml_dep_specs(dependency_dict): def read_yaml_dep_specs(dependency_dict):
"""Read the DependencySpec portion of a YAML-formatted Spec. """Read the DependencySpec portion of a YAML-formatted Spec.