aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter.py
diff options
context:
space:
mode:
authorJames Hilliard <james.hilliard1@gmail.com>2019-05-26 12:31:43 -0600
committerJussi Pakkanen <jpakkane@gmail.com>2019-08-12 01:05:45 +0300
commitb21fd95f737ab96f57c45e15a1d89d5c483daec8 (patch)
treef19e6f869220b3832d4e586901d10bb059d5a5d8 /mesonbuild/interpreter.py
parent8764e4f579287d2bc15d5ea8b0a5382c90712ec0 (diff)
downloadmeson-b21fd95f737ab96f57c45e15a1d89d5c483daec8.zip
meson-b21fd95f737ab96f57c45e15a1d89d5c483daec8.tar.gz
meson-b21fd95f737ab96f57c45e15a1d89d5c483daec8.tar.bz2
Add is_disabler function
This is useful if one needs to check if a variable is a disabler. Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r--mesonbuild/interpreter.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index d45b313..3a5dfaf 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -2147,6 +2147,7 @@ class Interpreter(InterpreterBase):
'install_headers': self.func_install_headers,
'install_man': self.func_install_man,
'install_subdir': self.func_install_subdir,
+ 'is_disabler': self.func_is_disabler,
'is_variable': self.func_is_variable,
'jar': self.func_jar,
'join_paths': self.func_join_paths,
@@ -4278,3 +4279,11 @@ This will become a hard error in the future.''', location=self.current_node)
if not isinstance(native, bool):
raise InvalidArguments('Argument to "native" must be a boolean.')
return MachineChoice.BUILD if native else MachineChoice.HOST
+
+ @FeatureNew('is_disabler', '0.52.0')
+ @noKwargs
+ def func_is_disabler(self, node, args, kwargs):
+ if len(args) != 1:
+ raise InvalidCode('Is_disabler takes one argument.')
+ varname = args[0]
+ return isinstance(varname, Disabler)