summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/graph.py13
-rw-r--r--lib/spack/spack/spec.py4
2 files changed, 9 insertions, 8 deletions
diff --git a/lib/spack/spack/graph.py b/lib/spack/spack/graph.py
index 063e4647b6..6a80c7d472 100644
--- a/lib/spack/spack/graph.py
+++ b/lib/spack/spack/graph.py
@@ -94,6 +94,7 @@ def topological_sort(spec, **kwargs):
nodes = spec.index()
topo_order = []
+ par = {name: parents(nodes[name]) for name in nodes.keys()}
remaining = [name for name in nodes.keys() if not parents(nodes[name])]
heapify(remaining)
@@ -102,12 +103,12 @@ def topological_sort(spec, **kwargs):
topo_order.append(name)
node = nodes[name]
- for dep in children(node).values():
- del parents(dep)[node.name]
- if not parents(dep):
+ for dep in children(node):
+ par[dep.name].remove(node)
+ if not par[dep.name]:
heappush(remaining, dep.name)
- if any(parents(s) for s in spec.traverse()):
+ if any(par.get(s.name, []) for s in spec.traverse()):
raise ValueError("Spec has cycles!")
else:
return topo_order
@@ -477,8 +478,8 @@ class AsciiGraph(object):
# Replace node with its dependencies
self._frontier.pop(i)
- if node.dependencies:
- deps = sorted((d for d in node.dependencies), reverse=True)
+ if node.dependencies():
+ deps = sorted((d.name for d in node.dependencies()), reverse=True)
self._connect_deps(i, deps, "new-deps") # anywhere.
elif self._frontier:
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index c6277fc8d2..8e44075f42 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -460,7 +460,7 @@ class DependencyMap(HashableMap):
def __str__(self):
return ''.join(
- ["^" + str(self[name].spec) for name in sorted(self.keys())])
+ ["^" + self[name].format() for name in sorted(self.keys())])
@key_ordering
@@ -861,7 +861,7 @@ class Spec(object):
for name in sorted(successors):
child = successors[name]
children = child.spec.traverse_with_deptype(
- visited, d=d + 1, deptype=deptype_query,
+ visited, d=d + 1, deptype=deptype,
deptype_query=deptype_query,
_self_deptype=child.deptypes, **kwargs)
for elt in children: