diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2019-11-05 05:39:56 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-05 05:39:56 -0700 |
commit | b77974e9862324cd0df4c99a9e7c4ab99b81c5f2 (patch) | |
tree | 2a3d244ce061ba52acc497c0b2a8b70728b6207e /lib | |
parent | 527d639b0eaddd949ac5dc2390be42f29252cfd0 (diff) | |
download | spack-b77974e9862324cd0df4c99a9e7c4ab99b81c5f2.tar.gz spack-b77974e9862324cd0df4c99a9e7c4ab99b81c5f2.tar.bz2 spack-b77974e9862324cd0df4c99a9e7c4ab99b81c5f2.tar.xz spack-b77974e9862324cd0df4c99a9e7c4ab99b81c5f2.zip |
`spack find` now displays variants and other spec constraints (#13596)
If you do this in a spack environment:
spack add hdf5+hl
hdf5+hl will be the root added to the `spack.yaml` file, and you should
really expect `hdf5+hl` to display as a root in the environment.
- [x] Add decoration to roots so that you can see the details about what
is required to build.
- [x] Add a test.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/cmd/__init__.py | 2 | ||||
-rw-r--r-- | lib/spack/spack/cmd/find.py | 14 | ||||
-rw-r--r-- | lib/spack/spack/test/cmd/env.py | 11 |
3 files changed, 23 insertions, 4 deletions
diff --git a/lib/spack/spack/cmd/__init__.py b/lib/spack/spack/cmd/__init__.py index fe0ed0c224..0d2e92940b 100644 --- a/lib/spack/spack/cmd/__init__.py +++ b/lib/spack/spack/cmd/__init__.py @@ -331,7 +331,7 @@ def display_specs(specs, args=None, **kwargs): format_string = get_arg('format', None) if format_string is None: - nfmt = '{namespace}.{name}' if namespace else '{name}' + nfmt = '{fullname}' if namespace else '{name}' ffmt = '' if full_compiler or flags: ffmt += '{%compiler.name}' diff --git a/lib/spack/spack/cmd/find.py b/lib/spack/spack/cmd/find.py index ed8f2ed2bf..37cfcd30d5 100644 --- a/lib/spack/spack/cmd/find.py +++ b/lib/spack/spack/cmd/find.py @@ -165,10 +165,18 @@ def display_env(env, args, decorator): tty.msg('No root specs') else: tty.msg('Root specs') - # TODO: Change this to not print extraneous deps and variants + + # Roots are displayed with variants, etc. so that we can see + # specifically what the user asked for. cmd.display_specs( - env.user_specs, args, - decorator=lambda s, f: color.colorize('@*{%s}' % f)) + env.user_specs, + args, + decorator=lambda s, f: color.colorize('@*{%s}' % f), + namespace=True, + show_flags=True, + show_full_compiler=True, + variants=True + ) print() if args.show_concretized: diff --git a/lib/spack/spack/test/cmd/env.py b/lib/spack/spack/test/cmd/env.py index b1e9e579ae..9b3ca6e66e 100644 --- a/lib/spack/spack/test/cmd/env.py +++ b/lib/spack/spack/test/cmd/env.py @@ -615,6 +615,17 @@ def test_env_blocks_uninstall(mock_stage, mock_fetch, install_mockery): assert 'used by the following environments' in out +def test_roots_display_with_variants(): + env('create', 'test') + with ev.read('test'): + add('boost+shared') + + with ev.read('test'): + out = find(output=str) + + assert "boost +shared" in out + + def test_uninstall_removes_from_env(mock_stage, mock_fetch, install_mockery): env('create', 'test') with ev.read('test'): |