summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2018-08-20 11:04:40 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2018-11-09 00:31:24 -0800
commit83323f4e71afdbeadfdc445c901d319c9b0e01d2 (patch)
tree47518eef7a5b180d5319878a745930d27382301e /lib
parent84140c6cd325b6a3130bd0e5df0afdf083ea7b1e (diff)
downloadspack-83323f4e71afdbeadfdc445c901d319c9b0e01d2.tar.gz
spack-83323f4e71afdbeadfdc445c901d319c9b0e01d2.tar.bz2
spack-83323f4e71afdbeadfdc445c901d319c9b0e01d2.tar.xz
spack-83323f4e71afdbeadfdc445c901d319c9b0e01d2.zip
bugfix: Avoid `KeyError` in compilers.yaml version check
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/hooks/yaml_version_check.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/spack/spack/hooks/yaml_version_check.py b/lib/spack/spack/hooks/yaml_version_check.py
index 57a8fac999..a6978673ac 100644
--- a/lib/spack/spack/hooks/yaml_version_check.py
+++ b/lib/spack/spack/hooks/yaml_version_check.py
@@ -27,8 +27,8 @@ def check_compiler_yaml_version():
data = syaml.load(f)
if data:
- compilers = data['compilers']
- if len(compilers) > 0:
+ compilers = data.get('compilers')
+ if compilers and len(compilers) > 0:
if (not isinstance(compilers, list) or
'operating_system' not in compilers[0]['compiler']):
new_file = os.path.join(scope.path, '_old_compilers.yaml')