[PATCH] build: Assert value properties only if not None

Chris Johns chrisj at rtems.org
Mon Jun 6 01:15:44 UTC 2022


OK

Thanks
Chris

On 3/6/2022 3:39 pm, Sebastian Huber wrote:
> ---
>  wscript | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/wscript b/wscript
> index 77269f126c..d4defd4f13 100755
> --- a/wscript
> +++ b/wscript
> @@ -738,7 +738,7 @@ class OptionItem(Item):
>          return value
>  
>      def _assert_aligned(self, conf, cic, value, arg):
> -        if value % arg != 0:
> +        if value is not None and value % arg != 0:
>              conf.fatal(
>                  "Value '{}' for option '{}' is not aligned by '{}'".format(
>                      value, self.data["name"], arg
> @@ -747,7 +747,7 @@ class OptionItem(Item):
>          return value
>  
>      def _assert_eq(self, conf, cic, value, arg):
> -        if value != arg:
> +        if value is not None and value != arg:
>              conf.fatal(
>                  "Value '{}' for option '{}' is not equal to {}".format(
>                      value, self.data["name"], arg
> @@ -756,7 +756,7 @@ class OptionItem(Item):
>          return value
>  
>      def _assert_ge(self, conf, cic, value, arg):
> -        if value < arg:
> +        if value is not None and value < arg:
>              conf.fatal(
>                  "Value '{}' for option '{}' is not greater than or equal to {}".format(
>                      value, self.data["name"], arg
> @@ -765,7 +765,7 @@ class OptionItem(Item):
>          return value
>  
>      def _assert_gt(self, conf, cic, value, arg):
> -        if value <= arg:
> +        if value is not None and value <= arg:
>              conf.fatal(
>                  "Value '{}' for option '{}' is not greater than {}".format(
>                      value, self.data["name"], arg
> @@ -774,7 +774,7 @@ class OptionItem(Item):
>          return value
>  
>      def _assert_in_interval(self, conf, cic, value, arg):
> -        if value < arg[0] or value > arg[1]:
> +        if value is not None and (value < arg[0] or value > arg[1]):
>              conf.fatal(
>                  "Value '{}' for option '{}' is not in closed interval [{}, {}]".format(
>                      value, self.data["name"], arg[0], arg[1]
> @@ -799,7 +799,7 @@ class OptionItem(Item):
>          )
>  
>      def _assert_le(self, conf, cic, value, arg):
> -        if value > arg:
> +        if value is not None and value > arg:
>              conf.fatal(
>                  "Value '{}' for option '{}' is not less than or equal to {}".format(
>                      value, self.data["name"], arg
> @@ -808,7 +808,7 @@ class OptionItem(Item):
>          return value
>  
>      def _assert_lt(self, conf, cic, value, arg):
> -        if value >= arg:
> +        if value is not None and value >= arg:
>              conf.fatal(
>                  "Value '{}' for option '{}' is not less than {}".format(
>                      value, self.data["name"], arg
> @@ -817,7 +817,7 @@ class OptionItem(Item):
>          return value
>  
>      def _assert_ne(self, conf, cic, value, arg):
> -        if value == arg:
> +        if value is not None and value == arg:
>              conf.fatal(
>                  "Value '{}' for option '{}' is not unequal to {}".format(
>                      value, self.data["name"], arg
> @@ -826,7 +826,7 @@ class OptionItem(Item):
>          return value
>  
>      def _assert_power_of_two(self, conf, cic, value, arg):
> -        if value <= 0 or (value & (value - 1)) != 0:
> +        if value is not None and (value <= 0 or (value & (value - 1)) != 0):
>              conf.fatal(
>                  "Value '{}' for option '{}' is not a power of two".format(
>                      value, self.data["name"]


More information about the devel mailing list