Add --show-full-compiler option to 'spack find'

When 'spack find' is invoked with the '--show-full-compiler' option,
the compiler flags and version are shown for each spec that is found.
This commit is contained in:
Matthew Scott Krafczyk 2017-08-28 12:35:46 -05:00 committed by scheibelp
parent 005b22aa8b
commit c94933343a
3 changed files with 15 additions and 5 deletions

View File

@ -211,6 +211,7 @@ def get_arg(name, default=None):
hashes = get_arg('long', False)
namespace = get_arg('namespace', False)
flags = get_arg('show_flags', False)
full_compiler = get_arg('show_full_compiler', False)
variants = get_arg('variants', False)
hlen = 7
@ -219,7 +220,12 @@ def get_arg(name, default=None):
hlen = None
nfmt = '.' if namespace else '_'
ffmt = '$%+' if flags else ''
ffmt = ''
if full_compiler or flags:
ffmt += '$%'
if full_compiler:
ffmt += '@'
ffmt += '+'
vfmt = '$+' if variants else ''
format_string = '$%s$@%s%s' % (nfmt, ffmt, vfmt)
@ -259,7 +265,7 @@ def get_arg(name, default=None):
elif mode == 'short':
# Print columns of output if not printing flags
if not flags:
if not flags and not full_compiler:
def fmt(s):
string = ""

View File

@ -60,6 +60,10 @@ def setup_parser(subparser):
action='store_true',
dest='show_flags',
help='show spec compiler flags')
subparser.add_argument('--show-full-compiler',
action='store_true',
dest='show_full_compiler',
help='show full compiler specs')
implicit_explicit = subparser.add_mutually_exclusive_group()
implicit_explicit.add_argument(
'-e', '--explicit',

View File

@ -407,9 +407,9 @@ function _spack_find {
if $list_options
then
compgen -W "-h --help -s --short -p --paths -d --deps -l --long
-L --very-long -f --show-flags -e --explicit
-E --implicit -u --unknown -m --missing -v --variants
-M --only-missing -N --namespace" -- "$cur"
-L --very-long -f --show-flags --show-full-compiler
-e --explicit -E --implicit -u --unknown -m --missing
-v --variants -M --only-missing -N --namespace" -- "$cur"
else
compgen -W "$(_installed_packages)" -- "$cur"
fi