Use bfs order in spack find --deps tree (#33782)

* Use bfs order in spack find --deps tree
* fix printing tests
This commit is contained in:
Harmen Stoppels 2022-11-11 00:39:07 +01:00 committed by GitHub
parent 6a3e20023e
commit 0077a25639
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 9 deletions

View file

@ -30,6 +30,7 @@
import spack.paths import spack.paths
import spack.spec import spack.spec
import spack.store import spack.store
import spack.traverse as traverse
import spack.user_environment as uenv import spack.user_environment as uenv
import spack.util.spack_json as sjson import spack.util.spack_json as sjson
import spack.util.string import spack.util.string
@ -464,11 +465,12 @@ def format_list(specs):
# create the final, formatted versions of all specs # create the final, formatted versions of all specs
formatted = [] formatted = []
for spec in specs: for spec in specs:
formatted.append((fmt(spec), spec))
if deps: if deps:
for depth, dep in spec.traverse(root=False, depth=True): for depth, dep in traverse.traverse_tree([spec], depth_first=False):
formatted.append((fmt(dep, depth), dep)) formatted.append((fmt(dep.spec, depth), dep.spec))
formatted.append(("", None)) # mark newlines formatted.append(("", None)) # mark newlines
else:
formatted.append((fmt(spec), spec))
# unless any of these are set, we can just colify and be done. # unless any of these are set, we can just colify and be done.
if not any((deps, paths)): if not any((deps, paths)):