Changed _set_architecture so if user inputs only the target, then os is None. This prevents the os being referenced before assignment error

This commit is contained in:
Mario Melara 2016-04-08 10:29:37 -07:00
parent 6ff6c805af
commit 0d1a1b7526

View File

@ -461,12 +461,17 @@ def _set_compiler(self, compiler):
def _set_architecture(self, architecture):
"""Called by the parser to set the architecture."""
if self.architecture: raise DuplicateArchitectureError(
"Spec for '%s' cannot have two architectures." % self.name)
"Spec for '%s' cannot have two architectures." % self.name)
if '-' in architecture:
os, target = architecture.split('-')
elif architecture == 'frontend' or architecture == 'backend':
os = architecture
target = architecture
else:
os = None
target = architecture
self.architecture = spack.architecture.Arch(os, target)