From 5ac974c9b2072631eab490cce8f2922420eef9e4 Mon Sep 17 00:00:00 2001 From: Gregory Becker Date: Wed, 4 Nov 2015 12:50:22 -0800 Subject: [PATCH] Enforced that the architecture subclass cannot add a target that shares a name with a target alias --- lib/spack/spack/architecture.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/spack/spack/architecture.py b/lib/spack/spack/architecture.py index 442180242b..890df9b1e5 100644 --- a/lib/spack/spack/architecture.py +++ b/lib/spack/spack/architecture.py @@ -77,9 +77,14 @@ def __init__(self, name): self.name = name def add_target(self, name, target): - self.targets[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 + + def target(self, name): """This is a getter method for the target dictionary that handles defaulting based on the values provided by default, front-end, and back-end. This can be overwritten