Enforced that the architecture subclass cannot add a target that shares a name with a target alias

This commit is contained in:
Gregory Becker 2015-11-04 12:50:22 -08:00
parent 058e72d29c
commit 5ac974c9b2

View file

@ -77,6 +77,11 @@ def __init__(self, name):
self.name = name self.name = name
def add_target(self, name, target): def add_target(self, name, target):
"""Used by the architecture specific subclass to list available targets. Raises an error
if the architecture specifies a name that is reserved by spack as an alias.
"""
if name in ['front_end', 'fe', 'back_end', 'be', 'default']:
raise ValueError("%s is a spack reserved alias and cannot be the name of a target" % name)
self.targets[name] = target self.targets[name] = target