meson: handle nested disabler

Fixes #5659
pull/5700/head
Marc-André Lureau 6 years ago committed by Dylan Baker
parent c8a6a44850
commit 3811101434
  1. 21
      mesonbuild/interpreterbase.py
  2. 1
      test cases/common/164 disabler/meson.build

@ -337,20 +337,25 @@ class Disabler(InterpreterObject):
def found_method(self, args, kwargs):
return False
def is_disabler(i):
def is_disabler(i) -> bool:
return isinstance(i, Disabler)
def is_disabled(args, kwargs):
def is_arg_disabled(arg) -> bool:
if is_disabler(arg):
return True
if isinstance(arg, list):
for i in arg:
if is_arg_disabled(i):
return True
return False
def is_disabled(args, kwargs) -> bool:
for i in args:
if isinstance(i, Disabler):
if is_arg_disabled(i):
return True
for i in kwargs.values():
if isinstance(i, Disabler):
if is_arg_disabled(i):
return True
if isinstance(i, list):
for j in i:
if isinstance(j, Disabler):
return True
return False
class InterpreterBase:

@ -33,6 +33,7 @@ assert(number == 2, 'If found handled incorrectly, value should be 2 but is @0@'
dep = dependency('notfounddep', required : false, disabler : true)
app = executable('myapp', 'notfound.c', dependencies : [dep])
app = executable('myapp', 'notfound.c', dependencies : [[dep]])
cc = meson.get_compiler('c')
dep = cc.find_library('notfounddep', required : false, disabler : true)

Loading…
Cancel
Save