coredata: init IntegerOption choices to the correct value

It's not a boolean, so let's avoid initializing it to invalid choices
followed by assigning it valid ones.
pull/7077/head
Eric Engestrom 5 years ago committed by Dylan Baker
parent 27bbf37cf0
commit 8ce4952890
  1. 6
      mesonbuild/coredata.py

@ -99,16 +99,16 @@ class UserBooleanOption(UserOption[bool]):
class UserIntegerOption(UserOption[int]):
def __init__(self, description, value, yielding=None):
min_value, max_value, default_value = value
super().__init__(description, [True, False], yielding)
self.min_value = min_value
self.max_value = max_value
self.set_value(default_value)
c = []
if min_value is not None:
c.append('>=' + str(min_value))
if max_value is not None:
c.append('<=' + str(max_value))
self.choices = ', '.join(c)
choices = ', '.join(c)
super().__init__(description, choices, yielding)
self.set_value(default_value)
def validate_value(self, value) -> int:
if isinstance(value, str):

Loading…
Cancel
Save