|
|
|
@ -1183,14 +1183,8 @@ class CompilerHolder(InterpreterObject): |
|
|
|
|
def has_argument_method(self, args, kwargs): |
|
|
|
|
args = mesonlib.stringlistify(args) |
|
|
|
|
if len(args) != 1: |
|
|
|
|
raise InterpreterException('Has_arg takes exactly one argument.') |
|
|
|
|
result = self.compiler.has_argument(args[0], self.environment) |
|
|
|
|
if result: |
|
|
|
|
h = mlog.green('YES') |
|
|
|
|
else: |
|
|
|
|
h = mlog.red('NO') |
|
|
|
|
mlog.log('Compiler for {} supports argument {}:'.format(self.compiler.get_display_language(), args[0]), h) |
|
|
|
|
return result |
|
|
|
|
raise InterpreterException('has_argument takes exactly one argument.') |
|
|
|
|
return self.has_multi_arguments_method(args, kwargs) |
|
|
|
|
|
|
|
|
|
@permittedMethodKwargs({}) |
|
|
|
|
def has_multi_arguments_method(self, args, kwargs): |
|
|
|
@ -1209,23 +1203,16 @@ class CompilerHolder(InterpreterObject): |
|
|
|
|
@permittedMethodKwargs({}) |
|
|
|
|
def get_supported_arguments_method(self, args, kwargs): |
|
|
|
|
args = mesonlib.stringlistify(args) |
|
|
|
|
result = self.compiler.get_supported_arguments(args, self.environment) |
|
|
|
|
if len(result) == len(args): |
|
|
|
|
h = mlog.green('YES') |
|
|
|
|
elif len(result) > 0: |
|
|
|
|
h = mlog.yellow('SOME') |
|
|
|
|
else: |
|
|
|
|
h = mlog.red('NO') |
|
|
|
|
mlog.log( |
|
|
|
|
'Compiler for {} supports arguments {}:'.format( |
|
|
|
|
self.compiler.get_display_language(), ' '.join(args)), |
|
|
|
|
h) |
|
|
|
|
return result |
|
|
|
|
supported_args = [] |
|
|
|
|
for arg in args: |
|
|
|
|
if self.has_argument_method(arg, kwargs): |
|
|
|
|
supported_args.append(arg) |
|
|
|
|
return supported_args |
|
|
|
|
|
|
|
|
|
@permittedMethodKwargs({}) |
|
|
|
|
def first_supported_argument_method(self, args, kwargs): |
|
|
|
|
for i in mesonlib.stringlistify(args): |
|
|
|
|
if self.compiler.has_argument(i, self.environment): |
|
|
|
|
if self.has_argument_method(i, kwargs): |
|
|
|
|
mlog.log('First supported argument:', mlog.bold(i)) |
|
|
|
|
return [i] |
|
|
|
|
mlog.log('First supported argument:', mlog.red('None')) |
|
|
|
|