summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGregory Becker <becker33@llnl.gov>2016-06-15 16:44:38 -0700
committerGregory Becker <becker33@llnl.gov>2016-06-15 16:44:38 -0700
commit3fcd54203c7e327f8ae9c08f0df91b033d63a459 (patch)
treeff0a1c0a2fb5ce4f2ee0cd4a27bde20f0fed9cc4 /lib
parent0fea167f97afb66d58e6c5555c4407ba5644e6c8 (diff)
parent2fc9ac4036eb017164cc6ac6f19e50dab5008759 (diff)
downloadspack-3fcd54203c7e327f8ae9c08f0df91b033d63a459.tar.gz
spack-3fcd54203c7e327f8ae9c08f0df91b033d63a459.tar.bz2
spack-3fcd54203c7e327f8ae9c08f0df91b033d63a459.tar.xz
spack-3fcd54203c7e327f8ae9c08f0df91b033d63a459.zip
two minor fixes
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/compilers/__init__.py12
-rw-r--r--lib/spack/spack/yaml_version_check.py6
2 files changed, 9 insertions, 9 deletions
diff --git a/lib/spack/spack/compilers/__init__.py b/lib/spack/spack/compilers/__init__.py
index 3cf8f2297f..4b546c2cbf 100644
--- a/lib/spack/spack/compilers/__init__.py
+++ b/lib/spack/spack/compilers/__init__.py
@@ -74,7 +74,7 @@ def _to_dict(compiler):
d['spec'] = str(compiler.spec)
d['paths'] = dict( (attr, getattr(compiler, attr, None)) for attr in _path_instance_vars )
d['operating_system'] = str(compiler.operating_system)
- d['modules'] = compiler.modules
+ d['modules'] = compiler.modules if compiler.modules else []
if compiler.alias:
d['alias'] = compiler.alias
@@ -139,11 +139,11 @@ def remove_compiler_from_config(compiler_spec, scope=None):
- scope: configuration scope to modify.
"""
compiler_config = get_compiler_config(scope)
- matches = [(a,c) for (a,c) in compiler_config.items() if c['spec'] == compiler_spec]
+ matches = [(a,c) for (a,c) in compiler_config.items() if c['spec'] == compiler_spec]
if len(matches) == 1:
del compiler_config[matches[0][0]]
else:
- CompilerSpecInsufficientlySpecificError(compiler_spec)
+ CompilerSpecInsufficientlySpecificError(compiler_spec)
spack.config.update_config('compilers', compiler_config, scope)
@@ -232,7 +232,7 @@ def compilers_for_spec(compiler_spec, scope=None, **kwargs):
if items['compiler']['spec'] != str(cspec):
continue
items = items['compiler']
-
+
if not ('paths' in items and all(n in items['paths'] for n in _path_instance_vars)):
raise InvalidCompilerConfigurationError(cspec)
@@ -255,7 +255,7 @@ def compilers_for_spec(compiler_spec, scope=None, **kwargs):
else:
operating_system = None
-
+
alias = items['alias'] if 'alias' in items else None
flags = {}
@@ -311,7 +311,7 @@ def all_os_classes():
this platform
"""
classes = []
-
+
platform = spack.architecture.sys_type()
for os_class in platform.operating_sys.values():
classes.append(os_class)
diff --git a/lib/spack/spack/yaml_version_check.py b/lib/spack/spack/yaml_version_check.py
index 5930eefafa..c2d084d6c3 100644
--- a/lib/spack/spack/yaml_version_check.py
+++ b/lib/spack/spack/yaml_version_check.py
@@ -46,10 +46,10 @@ def check_compiler_yaml_version():
if data:
compilers = data['compilers']
if len(compilers) > 0:
- if 'operating_system' not in compilers[0]['compiler']:
+ if (not isinstance(compilers, list)) or 'operating_system' not in compilers[0]['compiler']:
new_file = os.path.join(scope.path, '_old_compilers.yaml')
- tty.warn('%s in out of date compilers format. '
+ tty.warn('%s in out of date compilers format. '
'Moved to %s. Spack automatically generate '
- 'a compilers config file '
+ 'a compilers config file '
% (file_name, new_file))
os.rename(file_name, new_file)