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

View File

@ -60,6 +60,10 @@ def setup_parser(subparser):
action='store_true', action='store_true',
dest='show_flags', dest='show_flags',
help='show spec compiler 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 = subparser.add_mutually_exclusive_group()
implicit_explicit.add_argument( implicit_explicit.add_argument(
'-e', '--explicit', '-e', '--explicit',

View File

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