diff options
author | Eric Engestrom <eric@engestrom.ch> | 2020-05-03 21:54:37 +0200 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2020-05-04 09:59:25 -0700 |
commit | 8ce4952890c9ed25ee471d811990eb1fc3fb13b1 (patch) | |
tree | d9bc08f8f21dd78e9c7998542084c43c110d3904 | |
parent | 27bbf37cf016d138c287278272a058950f15e7db (diff) | |
download | meson-8ce4952890c9ed25ee471d811990eb1fc3fb13b1.zip meson-8ce4952890c9ed25ee471d811990eb1fc3fb13b1.tar.gz meson-8ce4952890c9ed25ee471d811990eb1fc3fb13b1.tar.bz2 |
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.
-rw-r--r-- | mesonbuild/coredata.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index 0b79084..d3ca4f6 100644 --- a/mesonbuild/coredata.py +++ b/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): |