aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/ast/interpreter.py1
-rw-r--r--mesonbuild/interpreter.py9
-rw-r--r--mesonbuild/interpreterbase.py2
3 files changed, 11 insertions, 1 deletions
diff --git a/mesonbuild/ast/interpreter.py b/mesonbuild/ast/interpreter.py
index 13c717b..6684ca4 100644
--- a/mesonbuild/ast/interpreter.py
+++ b/mesonbuild/ast/interpreter.py
@@ -106,6 +106,7 @@ class AstInterpreter(interpreterbase.InterpreterBase):
'subdir': self.func_subdir,
'set_variable': self.func_do_nothing,
'get_variable': self.func_do_nothing,
+ 'is_disabler': self.func_do_nothing,
'is_variable': self.func_do_nothing,
'disabler': self.func_do_nothing,
'gettext': self.func_do_nothing,
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)
diff --git a/mesonbuild/interpreterbase.py b/mesonbuild/interpreterbase.py
index b5510cf..082515c 100644
--- a/mesonbuild/interpreterbase.py
+++ b/mesonbuild/interpreterbase.py
@@ -767,7 +767,7 @@ The result of this is undefined and will become a hard error in a future Meson r
def function_call(self, node):
func_name = node.func_name
(posargs, kwargs) = self.reduce_arguments(node.args)
- if is_disabled(posargs, kwargs):
+ if is_disabled(posargs, kwargs) and func_name != 'set_variable' and func_name != 'is_disabler':
return Disabler()
if func_name in self.funcs:
func = self.funcs[func_name]