summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPeter Josef Scheibel <scheibel1@llnl.gov>2018-05-18 16:12:38 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2018-11-09 00:31:24 -0800
commit4daa164fbf6902a31f63db93c0a2401eb3bf90d6 (patch)
tree52f8840b8c4ca66046f00cee98d3d08d17f713ae /lib
parente6c6ab64b890cc6039c3a551520738aeb5d48081 (diff)
downloadspack-4daa164fbf6902a31f63db93c0a2401eb3bf90d6.tar.gz
spack-4daa164fbf6902a31f63db93c0a2401eb3bf90d6.tar.bz2
spack-4daa164fbf6902a31f63db93c0a2401eb3bf90d6.tar.xz
spack-4daa164fbf6902a31f63db93c0a2401eb3bf90d6.zip
specs: allow writing full spec (including build deps) to dict
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/spec.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index 1579c5c011..8336a6f8a0 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -1431,7 +1431,7 @@ class Spec(object):
return self._full_hash[:length]
- def to_node_dict(self, hash_function=None):
+ def to_node_dict(self, hash_function=None, all_deps=False):
d = syaml_dict()
if self.versions:
@@ -1464,7 +1464,11 @@ class Spec(object):
# TODO: restore build dependencies here once we have less picky
# TODO: concretization.
- deps = self.dependencies_dict(deptype=('link', 'run'))
+ if all_deps:
+ deptypes = ('link', 'run', 'build')
+ else:
+ deptypes = ('link', 'run')
+ deps = self.dependencies_dict(deptype=deptypes)
if deps:
if hash_function is None:
hash_function = lambda s: s.dag_hash()
@@ -1478,10 +1482,14 @@ class Spec(object):
return syaml_dict([(self.name, d)])
- def to_dict(self):
+ def to_dict(self, all_deps=False):
+ if all_deps:
+ deptypes = ('link', 'run', 'build')
+ else:
+ deptypes = ('link', 'run')
node_list = []
- for s in self.traverse(order='pre', deptype=('link', 'run')):
- node = s.to_node_dict()
+ for s in self.traverse(order='pre', deptype=deptypes):
+ node = s.to_node_dict(all_deps=all_deps)
node[s.name]['hash'] = s.dag_hash()
node_list.append(node)