From 7e8f1de063eea43bd9ff390e1573bd7ff475db54 Mon Sep 17 00:00:00 2001 From: Daniel Mensinger Date: Mon, 25 May 2020 10:06:41 +0200 Subject: opts: Allow string concatenation (fixes #7199) --- mesonbuild/optinterpreter.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'mesonbuild/optinterpreter.py') 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.') -- cgit v1.1