summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAdam J. Stewart <ajstewart426@gmail.com>2017-06-25 22:42:38 -0500
committerTodd Gamblin <tgamblin@llnl.gov>2017-06-25 20:42:38 -0700
commitad1382e66491a1e9340e506c85a5f195c9c30a5b (patch)
treef53b3f4a62b648a6e5514f9dd2c84e434e9e6296 /lib
parent1d82ccd25c3ed82617efca82d1261ada8c310055 (diff)
downloadspack-ad1382e66491a1e9340e506c85a5f195c9c30a5b.tar.gz
spack-ad1382e66491a1e9340e506c85a5f195c9c30a5b.tar.bz2
spack-ad1382e66491a1e9340e506c85a5f195c9c30a5b.tar.xz
spack-ad1382e66491a1e9340e506c85a5f195c9c30a5b.zip
Don't immediately raise an error when an editor is not found (#4587)
* Don't immediately raise an error when an editor is not found * If no editor is found, raise an error only if we try to use it.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/__init__.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/spack/spack/__init__.py b/lib/spack/spack/__init__.py
index 1f583fff61..e77a0c75cd 100644
--- a/lib/spack/spack/__init__.py
+++ b/lib/spack/spack/__init__.py
@@ -223,12 +223,13 @@ if editor is not None:
else:
editor = which('vim', 'vi', 'emacs', 'nano')
+# If there is no editor, only raise an error if we actually try to use it.
if not editor:
- default = default_editors[0]
- msg = 'Default text editor, {0}, not found.\n'.format(default)
- msg += 'Please set the EDITOR environment variable to your preferred '
- msg += 'text editor, or install {0}.'.format(default)
- raise EnvironmentError(msg)
+ def editor_not_found(*args, **kwargs):
+ raise EnvironmentError(
+ 'No text editor found! Please set the EDITOR environment variable '
+ 'to your preferred text editor.')
+ editor = editor_not_found
from spack.package import \
install_dependency_symlinks, flatten_dependencies, \