summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarmen Stoppels <harmenstoppels@gmail.com>2022-11-11 00:39:07 +0100
committerGitHub <noreply@github.com>2022-11-10 15:39:07 -0800
commit0077a256395cca537af4fe16a7235f5e3dce3657 (patch)
tree92b8c133d6c111aa6d27df96462a8e7efe59bc02
parent6a3e20023e8b05bf9b3dbce3cdabde7b913ac555 (diff)
downloadspack-0077a256395cca537af4fe16a7235f5e3dce3657.tar.gz
spack-0077a256395cca537af4fe16a7235f5e3dce3657.tar.bz2
spack-0077a256395cca537af4fe16a7235f5e3dce3657.tar.xz
spack-0077a256395cca537af4fe16a7235f5e3dce3657.zip
Use bfs order in spack find --deps tree (#33782)
* Use bfs order in spack find --deps tree * fix printing tests
-rw-r--r--lib/spack/spack/cmd/__init__.py8
-rw-r--r--lib/spack/spack/test/cmd/find.py12
2 files changed, 11 insertions, 9 deletions
diff --git a/lib/spack/spack/cmd/__init__.py b/lib/spack/spack/cmd/__init__.py
index ee1297e51c..ef02e8f9e4 100644
--- a/lib/spack/spack/cmd/__init__.py
+++ b/lib/spack/spack/cmd/__init__.py
@@ -30,6 +30,7 @@ import spack.extensions
import spack.paths
import spack.spec
import spack.store
+import spack.traverse as traverse
import spack.user_environment as uenv
import spack.util.spack_json as sjson
import spack.util.string
@@ -464,11 +465,12 @@ def display_specs(specs, args=None, **kwargs):
# create the final, formatted versions of all specs
formatted = []
for spec in specs:
- formatted.append((fmt(spec), spec))
if deps:
- for depth, dep in spec.traverse(root=False, depth=True):
- formatted.append((fmt(dep, depth), dep))
+ for depth, dep in traverse.traverse_tree([spec], depth_first=False):
+ formatted.append((fmt(dep.spec, depth), dep.spec))
formatted.append(("", None)) # mark newlines
+ else:
+ formatted.append((fmt(spec), spec))
# unless any of these are set, we can just colify and be done.
if not any((deps, paths)):
diff --git a/lib/spack/spack/test/cmd/find.py b/lib/spack/spack/test/cmd/find.py
index 9f3f453bad..653e070e1a 100644
--- a/lib/spack/spack/test/cmd/find.py
+++ b/lib/spack/spack/test/cmd/find.py
@@ -269,9 +269,9 @@ mpileaks-2.3
callpath-1.0
dyninst-8.2
libdwarf-20130729
- libelf-0.8.13
- zmpi-1.0
- fake-1.0
+ libelf-0.8.13
+ zmpi-1.0
+ fake-1.0
"""
)
@@ -291,9 +291,9 @@ mpileaks-2.3 {0}
callpath-1.0 {1}
dyninst-8.2 {2}
libdwarf-20130729 {3}
- libelf-0.8.13 {4}
- zmpi-1.0 {5}
- fake-1.0 {6}
+ libelf-0.8.13 {4}
+ zmpi-1.0 {5}
+ fake-1.0 {6}
""".format(
*prefixes