From 527a81b469cf3df12e4b8c3bcd8609b2d55db2f3 Mon Sep 17 00:00:00 2001 From: Greg Becker Date: Wed, 11 Nov 2020 22:13:51 -0800 Subject: Keep output machine readable using `spack find --format` in an env (#19698) Currently, full JSON output is the only machine readable option for `spack find` in an environment. `spack find --format` is also designed to be machine readable, but we print extra headers in environments. -[x] don't print headers in `spack find` output when in an environment --- lib/spack/spack/cmd/find.py | 5 +++-- lib/spack/spack/test/cmd/find.py | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/spack/spack/cmd/find.py b/lib/spack/spack/cmd/find.py index db229aca7e..d9d51b853c 100644 --- a/lib/spack/spack/cmd/find.py +++ b/lib/spack/spack/cmd/find.py @@ -235,8 +235,9 @@ def find(parser, args): if args.json: cmd.display_specs_as_json(results, deps=args.deps) else: - if env: - display_env(env, args, decorator) + if not args.format: + if env: + display_env(env, args, decorator) if sys.stdout.isatty() and args.groups: tty.msg("%s" % plural(len(results), 'installed package')) cmd.display_specs( diff --git a/lib/spack/spack/test/cmd/find.py b/lib/spack/spack/test/cmd/find.py index 8d3c68d31a..9d2203aaaf 100644 --- a/lib/spack/spack/test/cmd/find.py +++ b/lib/spack/spack/test/cmd/find.py @@ -209,6 +209,7 @@ def test_find_format(database, config): output = find('--format', '{name}-{version}-{compiler.name}-{^mpi.name}', 'mpileaks') + assert "installed package" not in output assert set(output.strip().split('\n')) == set([ "mpileaks-2.3-gcc-zmpi", "mpileaks-2.3-gcc-mpich", -- cgit v1.2.3-60-g2f50