aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/optinterpreter.py
diff options
context:
space:
mode:
authorDaniel Mensinger <daniel@mensinger-ka.de>2020-05-25 10:06:41 +0200
committerXavier Claessens <xclaesse@gmail.com>2020-05-26 13:48:26 -0400
commit7e8f1de063eea43bd9ff390e1573bd7ff475db54 (patch)
tree721e14f5abbb4f29b19305a4b69dd1751b0f3177 /mesonbuild/optinterpreter.py
parent1d02fd924bdd407f99b278286efff5aae98535cb (diff)
downloadmeson-7e8f1de063eea43bd9ff390e1573bd7ff475db54.zip
meson-7e8f1de063eea43bd9ff390e1573bd7ff475db54.tar.gz
meson-7e8f1de063eea43bd9ff390e1573bd7ff475db54.tar.bz2
opts: Allow string concatenation (fixes #7199)
Diffstat (limited to 'mesonbuild/optinterpreter.py')
-rw-r--r--mesonbuild/optinterpreter.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/mesonbuild/optinterpreter.py b/mesonbuild/optinterpreter.py
index dfbe6d7..81206ab 100644
--- a/mesonbuild/optinterpreter.py
+++ b/mesonbuild/optinterpreter.py
@@ -177,6 +177,13 @@ class OptionInterpreter:
if not isinstance(res, bool):
raise OptionException('Token after "not" is not a a boolean')
return not res
+ elif isinstance(arg, mparser.ArithmeticNode):
+ l = self.reduce_single(arg.left)
+ r = self.reduce_single(arg.right)
+ if not (arg.operation == 'add' and isinstance(l, str) and isinstance(r, str)):
+ raise OptionException('Only string concatenation with the "+" operator is allowed')
+ FeatureNew.single_use('string concatenation in meson_options.txt', '0.55.0', self.subproject)
+ return l + r
else:
raise OptionException('Arguments may only be string, int, bool, or array of those.')