[PATCH 1/8] build: Add assert-in-set option action

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Apr 4 14:52:51 UTC 2023


---
 wscript | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/wscript b/wscript
index 567f42db2f..a5c8b5f236 100755
--- a/wscript
+++ b/wscript
@@ -825,6 +825,13 @@ class OptionItem(Item):
                     value, self.data["name"], arg))
         return value
 
+    def _assert_in_set(self, conf, cic, value, arg):
+        if value is not None and value not in arg:
+            conf.fatal(
+                "Value '{}' for option '{}' is not an element of {}"
+                .format(value, self.data["name"], arg))
+        return value
+
     def _assert_in_interval(self, conf, cic, value, arg):
         if value is not None and (value < arg[0] or value > arg[1]):
             conf.fatal(
@@ -1056,6 +1063,7 @@ class OptionItem(Item):
             "assert-eq": self._assert_eq,
             "assert-ge": self._assert_ge,
             "assert-gt": self._assert_gt,
+            "assert-in-set": self._assert_in_set,
             "assert-int8": self._assert_int8,
             "assert-int16": self._assert_int16,
             "assert-int32": self._assert_int32,
-- 
2.35.3



More information about the devel mailing list