summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2018-10-22 10:49:43 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2018-11-09 00:31:24 -0800
commit66aa3426ac845fe611bfd81f2000d5527fc8cb03 (patch)
treef7f6e8f8516acdaee48fcc77e45e9730b2f928a4
parenta1818f971f20e4b9ac22dad70b95d764921acbe4 (diff)
downloadspack-66aa3426ac845fe611bfd81f2000d5527fc8cb03.tar.gz
spack-66aa3426ac845fe611bfd81f2000d5527fc8cb03.tar.bz2
spack-66aa3426ac845fe611bfd81f2000d5527fc8cb03.tar.xz
spack-66aa3426ac845fe611bfd81f2000d5527fc8cb03.zip
env: make install_status output more concise
-rw-r--r--lib/spack/spack/cmd/env.py6
-rw-r--r--lib/spack/spack/environment.py52
-rw-r--r--lib/spack/spack/spec.py2
3 files changed, 46 insertions, 14 deletions
diff --git a/lib/spack/spack/cmd/env.py b/lib/spack/spack/cmd/env.py
index 861b743350..c2a3e52cb5 100644
--- a/lib/spack/spack/cmd/env.py
+++ b/lib/spack/spack/cmd/env.py
@@ -434,7 +434,7 @@ def env_status_setup_parser(subparser):
'env', nargs='?', help='name of environment to show status for')
arguments.add_common_arguments(
subparser,
- ['recurse_dependencies', 'long', 'very_long', 'install_status'])
+ ['recurse_dependencies', 'long', 'very_long'])
def env_status(args):
@@ -443,14 +443,12 @@ def env_status(args):
tty.msg('No active environment')
return
- tty.msg('In environment %s' % env.path)
-
# TODO: option to show packages w/ multiple instances?
env.status(
sys.stdout, recurse_dependencies=args.recurse_dependencies,
hashes=args.long or args.very_long,
hashlen=None if args.very_long else 7,
- install_status=args.install_status)
+ install_status=True)
#
diff --git a/lib/spack/spack/environment.py b/lib/spack/spack/environment.py
index 88cc00f7c2..a088906d04 100644
--- a/lib/spack/spack/environment.py
+++ b/lib/spack/spack/environment.py
@@ -7,13 +7,13 @@ import os
import re
import sys
import shutil
-from six.moves import zip_longest
import jsonschema
import ruamel.yaml
import llnl.util.filesystem as fs
import llnl.util.tty as tty
+import llnl.util.tty.color as color
import spack.error
import spack.repo
@@ -589,14 +589,48 @@ class Environment(object):
def status(self, stream, **kwargs):
"""List the specs in an environment."""
- for user_spec, concretized_hash in zip_longest(
- self.user_specs, self.concretized_order):
-
- stream.write('========= {0}\n'.format(user_spec))
-
- if concretized_hash:
- concretized_spec = self.specs_by_hash[concretized_hash]
- stream.write(concretized_spec.tree(**kwargs))
+ if self.path.startswith(env_path):
+ name = os.path.basename(self.path)
+ else:
+ name = self.path
+
+ tty.msg('In environment %s' % name)
+
+ concretized = [(spec, self.specs_by_hash[h])
+ for spec, h in zip(self.concretized_user_specs,
+ self.concretized_order)]
+
+ added = [s for s in self.user_specs
+ if s not in self.concretized_user_specs]
+ removed = [(s, c) for s, c in concretized if s not in self.user_specs]
+ current = [(s, c) for s, c in concretized if s in self.user_specs]
+
+ def write_kind(s):
+ color.cwrite('@c{%s}\n' % str(s), stream)
+
+ def write_user_spec(s, c):
+ color.cwrite('@%s{----} %s\n' % (c, str(s)), stream)
+
+ if added:
+ write_kind('added:')
+ for s in added:
+ write_user_spec(s, 'g')
+
+ if current:
+ if added:
+ stream.write('\n')
+ write_kind('concrete:')
+ for s, c in current:
+ write_user_spec(s, 'K')
+ stream.write(c.tree(**kwargs))
+
+ if removed:
+ if added or current:
+ stream.write('\n')
+ write_kind('removed:')
+ for s, c in removed:
+ write_user_spec(s, 'r')
+ stream.write(c.tree(**kwargs))
def upgrade_dependency(self, dep_name, dry_run=False):
# TODO: if you have
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index d5bc56fb6c..bebb1ca967 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -3245,7 +3245,7 @@ class Spec(object):
if install_status:
status = node._install_status()
if status is None:
- out += " " # Package isn't installed
+ out += colorize("@K{ - } ", color=color) # not installed
elif status:
out += colorize("@g{[+]} ", color=color) # installed
else: