specs: allow writing full spec (including build deps) to dict
This commit is contained in:
parent
e6c6ab64b8
commit
4daa164fbf
@ -1431,7 +1431,7 @@ def full_hash(self, length=None):
|
||||
|
||||
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 @@ def to_node_dict(self, hash_function=None):
|
||||
|
||||
# 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 @@ def to_node_dict(self, hash_function=None):
|
||||
|
||||
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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user