diff options
-rw-r--r-- | rtems_waf/config/options.py | 25 | ||||
-rw-r--r-- | rtems_waf/defaults/options.py | 1 |
2 files changed, 26 insertions, 0 deletions
diff --git a/rtems_waf/config/options.py b/rtems_waf/config/options.py index 9ec02b7e37..7933fc3b95 100644 --- a/rtems_waf/config/options.py +++ b/rtems_waf/config/options.py @@ -8,6 +8,12 @@ wrapper.initial_indent = "# " wrapper.subsequent_indent = "# " +tag_map = { + "general": "General settings", + "build": "Build options", + "network": "Network option", + "storage": "Storage option" +} class OptionMeta(type): """Self register options.""" @@ -36,6 +42,10 @@ class Option(object): .. py:attribute:: quote=False Whether to quote the value in the header. + + .. py:attribute:: tag=list + + List of tags for this option. At least one is required. """ def __init__(self, value=None): @@ -50,6 +60,21 @@ class Option(object): if not hasattr(self, "quote"): self.quote = False + # Tag sanity check. + if not hasattr(self, "tag"): +# raise Exception("At least one tag is required") # XXX: enable when all options have been set + print "%s: Missing tag! At least one is required." % self.name + elif type(self.tag) is not list: + raise Exception("%s.tag: must be a list()." % self.name) + 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) + 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)) + + # Value limit if not hasattr(self, "limit"): self.limit = None diff --git a/rtems_waf/defaults/options.py b/rtems_waf/defaults/options.py index 2cf1af7a72..7e536fe049 100644 --- a/rtems_waf/defaults/options.py +++ b/rtems_waf/defaults/options.py @@ -28,6 +28,7 @@ If defined, disable features which are not supported on skyeye. class BSP(StringList): + tag = ["general"] value = [] undef = True descr = "List of bsps to build, comma delimited." |