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.
This commit is contained in:
Todd Gamblin 2019-11-05 05:39:56 -07:00 committed by GitHub
parent 527d639b0e
commit b77974e986
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 4 deletions

View file

@ -331,7 +331,7 @@ def get_arg(name, default=None):
format_string = get_arg('format', None) format_string = get_arg('format', None)
if format_string is None: if format_string is None:
nfmt = '{namespace}.{name}' if namespace else '{name}' nfmt = '{fullname}' if namespace else '{name}'
ffmt = '' ffmt = ''
if full_compiler or flags: if full_compiler or flags:
ffmt += '{%compiler.name}' ffmt += '{%compiler.name}'

View file

@ -165,10 +165,18 @@ def display_env(env, args, decorator):
tty.msg('No root specs') tty.msg('No root specs')
else: else:
tty.msg('Root specs') 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( cmd.display_specs(
env.user_specs, args, env.user_specs,
decorator=lambda s, f: color.colorize('@*{%s}' % f)) args,
decorator=lambda s, f: color.colorize('@*{%s}' % f),
namespace=True,
show_flags=True,
show_full_compiler=True,
variants=True
)
print() print()
if args.show_concretized: if args.show_concretized:

View file

@ -615,6 +615,17 @@ def test_env_blocks_uninstall(mock_stage, mock_fetch, install_mockery):
assert 'used by the following environments' in out 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): def test_uninstall_removes_from_env(mock_stage, mock_fetch, install_mockery):
env('create', 'test') env('create', 'test')
with ev.read('test'): with ev.read('test'):