summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2014-12-29 20:55:02 -0800
committerTodd Gamblin <tgamblin@llnl.gov>2014-12-29 21:11:28 -0800
commitbb3dafa3b5d978b7e68eceeb7faf8b5d156f3058 (patch)
treed554197c77030de0698831b096fe90da0a5a4f33
parentdaf1e229f7a5b5210651d5beddaec6ef1ed125bf (diff)
downloadspack-bb3dafa3b5d978b7e68eceeb7faf8b5d156f3058.tar.gz
spack-bb3dafa3b5d978b7e68eceeb7faf8b5d156f3058.tar.bz2
spack-bb3dafa3b5d978b7e68eceeb7faf8b5d156f3058.tar.xz
spack-bb3dafa3b5d978b7e68eceeb7faf8b5d156f3058.zip
Reduce number of immediate expand/contracts.
-rw-r--r--lib/spack/spack/spec.py30
1 files changed, 21 insertions, 9 deletions
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index 2cd7bfb6be..a8d080b0d2 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -1444,18 +1444,30 @@ class Spec(object):
frontier.pop(i)
elif len(frontier[i]) > 1:
- name = frontier[i].pop(0)
- deps = [name]
-
+ # Expand forawrd after doing all back connections
out.write(indent)
out.write("| " * i)
- out.write("|\ ")
- out.write("\ " * (len(frontier) - i - 1))
- out.write("\n")
+ out.write("|\\")
+
+ if (i+1 < len(frontier) and len(frontier[i+1]) == 1
+ and frontier[i+1][0] in frontier[i]):
+ # We need to connect to the element to the right.
+ # Keep lines straight by connecting directly and
+ # avoiding immediate expand/contract.
+ name = frontier[i+1][0]
+ frontier[i].remove(name)
+ out.write("| " * (len(frontier) - i - 1))
+ out.write("\n")
- connect_deps(i, deps, label="expansion")
-
- # Handle any back edges to the right
+ else:
+ # Just allow the expansion here.
+ name = frontier[i].pop(0)
+ deps = [name]
+ out.write(" \\" * (len(frontier) - i - 1))
+ out.write("\n")
+ connect_deps(i, deps, label="expansion")
+
+ # Handle any remaining back edges to the right
j = i+1
while j < len(frontier):
deps = frontier.pop(j)