summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2016-01-17 18:12:53 -0800
committerTodd Gamblin <tgamblin@llnl.gov>2016-01-17 18:12:53 -0800
commit5984bc2ad3b3d161ac8e8c37ec1dc3dfa9250241 (patch)
tree349805ddf54607a0a8b1aed6a28e94f984d9dd83 /lib
parent358b2ab4ba9d08bc47b59bf39811b6472acbc53a (diff)
downloadspack-5984bc2ad3b3d161ac8e8c37ec1dc3dfa9250241.tar.gz
spack-5984bc2ad3b3d161ac8e8c37ec1dc3dfa9250241.tar.bz2
spack-5984bc2ad3b3d161ac8e8c37ec1dc3dfa9250241.tar.xz
spack-5984bc2ad3b3d161ac8e8c37ec1dc3dfa9250241.zip
Add namespace option to find command.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/cmd/find.py27
1 files changed, 18 insertions, 9 deletions
diff --git a/lib/spack/spack/cmd/find.py b/lib/spack/spack/cmd/find.py
index d951c37fe0..714f1d514b 100644
--- a/lib/spack/spack/cmd/find.py
+++ b/lib/spack/spack/cmd/find.py
@@ -41,6 +41,9 @@ description ="Find installed spack packages"
def setup_parser(subparser):
format_group = subparser.add_mutually_exclusive_group()
format_group.add_argument(
+ '-s', '--short', action='store_const', dest='mode', const='short',
+ help='Show only specs (default)')
+ format_group.add_argument(
'-p', '--paths', action='store_const', dest='mode', const='paths',
help='Show paths to package install directories')
format_group.add_argument(
@@ -48,21 +51,24 @@ def setup_parser(subparser):
help='Show full dependency DAG of installed packages')
subparser.add_argument(
- '-l', '--long', action='store_true', dest='long',
+ '-l', '--long', action='store_true',
help='Show dependency hashes as well as versions.')
subparser.add_argument(
- '-L', '--very-long', action='store_true', dest='very_long',
+ '-L', '--very-long', action='store_true',
help='Show dependency hashes as well as versions.')
subparser.add_argument(
- '-u', '--unknown', action='store_true', dest='unknown',
+ '-u', '--unknown', action='store_true',
help='Show only specs Spack does not have a package for.')
subparser.add_argument(
- '-m', '--missing', action='store_true', dest='missing',
+ '-m', '--missing', action='store_true',
help='Show missing dependencies as well as installed specs.')
subparser.add_argument(
- '-M', '--only-missing', action='store_true', dest='only_missing',
+ '-M', '--only-missing', action='store_true',
help='Show only missing dependencies.')
+ subparser.add_argument(
+ '-N', '--namespace', action='store_true',
+ help='Show fully qualified package names.')
subparser.add_argument(
'query_specs', nargs=argparse.REMAINDER,
@@ -76,6 +82,7 @@ def gray_hash(spec, length):
def display_specs(specs, **kwargs):
mode = kwargs.get('mode', 'short')
hashes = kwargs.get('long', False)
+ namespace = kwargs.get('namespace', False)
hlen = 7
if kwargs.get('very_long', False):
@@ -97,7 +104,8 @@ def display_specs(specs, **kwargs):
specs = index[(architecture,compiler)]
specs.sort()
- abbreviated = [s.format('$_$@$+', color=True) for s in specs]
+ nfmt = '.' if namespace else '_'
+ abbreviated = [s.format('$%s$@$+' % nfmt, color=True) for s in specs]
if mode == 'paths':
# Print one spec per line along with prefix path
width = max(len(s) for s in abbreviated)
@@ -112,7 +120,7 @@ def display_specs(specs, **kwargs):
elif mode == 'deps':
for spec in specs:
print spec.tree(
- format='$_$@$+',
+ format='$%s$@$+' % nfmt,
color=True,
indent=4,
prefix=(lambda s: gray_hash(s, hlen)) if hashes else None)
@@ -122,7 +130,7 @@ def display_specs(specs, **kwargs):
string = ""
if hashes:
string += gray_hash(s, hlen) + ' '
- string += s.format('$-_$@$+', color=True)
+ string += s.format('$-%s$@$+' % nfmt, color=True)
return string
colify(fmt(s) for s in specs)
@@ -171,4 +179,5 @@ def find(parser, args):
tty.msg("%d installed packages." % len(specs))
display_specs(specs, mode=args.mode,
long=args.long,
- very_long=args.very_long)
+ very_long=args.very_long,
+ namespace=args.namespace)