aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2020-06-16 11:11:15 -0700
committerDylan Baker <dylan@pnwbakers.com>2020-08-01 22:00:06 -0700
commit17c8193615e5fafbbfcf99b1d028f5da36d79cc4 (patch)
tree19f01d3c08945f1f69f83cbacfa4fe729317f9c0 /mesonbuild
parentbbba6a7f365f8b7dc7f2d4c3ce7f3e5f4c05fc5e (diff)
downloadmeson-17c8193615e5fafbbfcf99b1d028f5da36d79cc4.zip
meson-17c8193615e5fafbbfcf99b1d028f5da36d79cc4.tar.gz
meson-17c8193615e5fafbbfcf99b1d028f5da36d79cc4.tar.bz2
machine-files: give better error messages about using integers
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/coredata.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py
index 0cac029..b7efe30 100644
--- a/mesonbuild/coredata.py
+++ b/mesonbuild/coredata.py
@@ -161,10 +161,16 @@ class UserComboOption(UserOption[str]):
def validate_value(self, value):
if value not in self.choices:
+ if isinstance(value, bool):
+ _type = 'boolean'
+ elif isinstance(value, (int, float)):
+ _type = 'number'
+ else:
+ _type = 'string'
optionsstring = ', '.join(['"%s"' % (item,) for item in self.choices])
- raise MesonException('Value "{}" for combo option "{}" is not one of the choices.'
- ' Possible choices are: {}.'.format(
- value, self.description, optionsstring))
+ raise MesonException('Value "{}" (of type "{}") for combo option "{}" is not one of the choices.'
+ ' Possible choices are (as string): {}.'.format(
+ value, _type, self.description, optionsstring))
return value
class UserArrayOption(UserOption[T.List[str]]):