diff --git a/bin/spack b/bin/spack index 922e6a6be450a5d2a7b4622d865b8aea9b7d765c..5ab805fe549c2def52584e1465505ddc45043cfa 100755 --- a/bin/spack +++ b/bin/spack @@ -194,6 +194,8 @@ def _main(args, unknown_args): return_val = command(parser, args) except SpackError as e: e.die() + except Exception as e: + tty.die(str(e)) except KeyboardInterrupt: sys.stderr.write('\n') tty.die("Keyboard interrupt.") diff --git a/lib/spack/spack/variant.py b/lib/spack/spack/variant.py index 7102676b69cc131452ca8ad4467c4c629606209b..2d02ab1253c46b7b3571c60f15f6ea95f7564393 100644 --- a/lib/spack/spack/variant.py +++ b/lib/spack/spack/variant.py @@ -389,9 +389,9 @@ def _value_setter(self, value): self._original_value = value self._value = False else: - msg = 'cannot construct a BoolValuedVariant from ' + msg = 'cannot construct a BoolValuedVariant for "{0}" from ' msg += 'a value that does not represent a bool' - raise ValueError(msg) + raise ValueError(msg.format(self.name)) def __contains__(self, item): return item is self.value diff --git a/var/spack/repos/builtin/packages/emacs/package.py b/var/spack/repos/builtin/packages/emacs/package.py index 71733eebd27125a3681692e18e152d6844555da2..195cb1281f6a8f1e8787b7f8baabbb283c6fa799 100644 --- a/var/spack/repos/builtin/packages/emacs/package.py +++ b/var/spack/repos/builtin/packages/emacs/package.py @@ -36,8 +36,12 @@ class Emacs(AutotoolsPackage): version('24.5', 'd74b597503a68105e61b5b9f6d065b44') variant('X', default=False, description="Enable an X toolkit") - variant('toolkit', default='gtk', - description="Select an X toolkit (gtk, athena)") + variant( + 'toolkit', + default='gtk', + values=('gtk', 'athena'), + description="Select an X toolkit (gtk, athena)" + ) depends_on('pkg-config@0.9.0:', type='build') @@ -53,12 +57,9 @@ class Emacs(AutotoolsPackage): def configure_args(self): spec = self.spec - args = [] + toolkit = spec.variants['toolkit'].value if '+X' in spec: - if toolkit not in ('gtk', 'athena'): - raise InstallError("toolkit must be in (gtk, athena), not %s" % - toolkit) args = [ '--with-x', '--with-x-toolkit={0}'.format(toolkit)