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]
|
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()
|
d = syaml_dict()
|
||||||
|
|
||||||
if self.versions:
|
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: restore build dependencies here once we have less picky
|
||||||
# TODO: concretization.
|
# 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 deps:
|
||||||
if hash_function is None:
|
if hash_function is None:
|
||||||
hash_function = lambda s: s.dag_hash()
|
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)])
|
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 = []
|
node_list = []
|
||||||
for s in self.traverse(order='pre', deptype=('link', 'run')):
|
for s in self.traverse(order='pre', deptype=deptypes):
|
||||||
node = s.to_node_dict()
|
node = s.to_node_dict(all_deps=all_deps)
|
||||||
node[s.name]['hash'] = s.dag_hash()
|
node[s.name]['hash'] = s.dag_hash()
|
||||||
node_list.append(node)
|
node_list.append(node)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user