summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmar Takhar <amar@rtems.org>2015-06-06 10:38:09 -0400
committerAmar Takhar <amar@rtems.org>2015-12-11 15:16:14 -0500
commit677d8d9b2cea08fb326228140042b564a57ca241 (patch)
tree9da12d88dc0d78c4715f3060fd8b23fff560cb09
parentd27305263437ada81f3222e31759757425f2f2b0 (diff)
Enable fatal checking for tags.
Also fix errors to use _fatal() and simplify logic.
-rw-r--r--rtems_waf/config/options.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/rtems_waf/config/options.py b/rtems_waf/config/options.py
index 3206e874e2..a4724c77d3 100644
--- a/rtems_waf/config/options.py
+++ b/rtems_waf/config/options.py
@@ -61,20 +61,17 @@ class Option(object):
self.quote = False
# Tag sanity check.
- if not hasattr(self, "tag"):
-# if not hasattr(self, "tag") or self.tag == [""]: # XXX: temp until all tags have been added
- raise Exception("At least one tag is required")
- elif self.tag == [""]: # XXX: temp until all tags have been added
- print "%s: Missing tag!" % self.name
+ if not hasattr(self, "tag") or not self.tag:
+ self._fatal("At least one tag is required")
elif type(self.tag) is not list:
- raise Exception("%s.tag: must be a list()." % self.name)
+ self._fatal("%s.tag: must be a list().")
elif not set(self.tag).issubset(tag_map):
missing = [x for x in self.tag if x not in tag_map]
- raise Exception("Tag(s) %s do not exist." % missing)
+ self._fatal("Tag(s) %s do not exist." % missing)
else:
duplicates = set([x for x in self.tag if self.tag.count(x) > 1])
if duplicates:
- raise Exception("%s: duplicate tags: %s" % (self.name, duplicates))
+ self._fatal("duplicate tags: %s" % ", ".join(duplicates))
# Value limit
@@ -119,8 +116,7 @@ class Option(object):
def _fatal(self, str):
"""Fatal error"""
- print("Fatal->%s.%s: %s" % (self.__class__.__bases__[0].__name__, self.__class__.__name__, str))
- exit(1)
+ raise Exception("(%s)%s: %s" % (self.__class__.__bases__[0].__name__, self.__class__.__name__, str))
def config_get(self):