summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPeter Josef Scheibel <scheibel1@llnl.gov>2018-05-18 16:15:57 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2018-11-09 00:31:24 -0800
commitacdb391931d0c074ab2b6656163639bb04c4b1c4 (patch)
tree33318c1ac2b05f0309c79e9555c7249c919fd9c3 /lib
parent4daa164fbf6902a31f63db93c0a2401eb3bf90d6 (diff)
downloadspack-acdb391931d0c074ab2b6656163639bb04c4b1c4.tar.gz
spack-acdb391931d0c074ab2b6656163639bb04c4b1c4.tar.bz2
spack-acdb391931d0c074ab2b6656163639bb04c4b1c4.tar.xz
spack-acdb391931d0c074ab2b6656163639bb04c4b1c4.zip
specs: add convenience function for reading spec dependencies from node dict
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/spec.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index 8336a6f8a0..39dad67d2c 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -1559,6 +1559,15 @@ class Spec(object):
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
def read_yaml_dep_specs(dependency_dict):
"""Read the DependencySpec portion of a YAML-formatted Spec.