def _compile_args(self, compiler, state, kwargs): args = [] opts = state.environment.coredata.compiler_options args += compiler.get_option_compile_args(opts) args += compiler.get_option_link_args(opts) args += mesonlib.stringlistify(self.options.get('args', [])) args += mesonlib.stringlistify(kwargs.get('args', [])) return args
def __init__(self, name: str, environment: 'Environment', kwargs: T.Dict[str, T.Any], language: T.Optional[str] = None): super().__init__(DependencyTypeName('config-tool'), environment, kwargs, language=language) self.name = name # You may want to overwrite the class version in some cases self.tools = listify(kwargs.get('tools', self.tools)) if not self.tool_name: self.tool_name = self.tools[0] if 'version_arg' in kwargs: self.version_arg = kwargs['version_arg'] req_version_raw = kwargs.get('version', None) if req_version_raw is not None: req_version = mesonlib.stringlistify(req_version_raw) else: req_version = [] tool, version = self.find_config(req_version, kwargs.get('returncode_value', 0)) self.config = tool self.is_found = self.report_config(version, req_version) if not self.is_found: self.config = None return self.version = version
def parse_test_args(testdir): args = [] try: with open(os.path.join(testdir, 'test_args.txt'), 'r') as f: content = f.read() try: args = literal_eval(content) except Exception: raise Exception('Malformed test_args file.') args = stringlistify(args) except FileNotFoundError: pass return args
def symbol(self, state, args, kwargs): if len(args) != 1: raise InterpreterException('symbol takes exactly one argument.') check_stringlist(args) disabled, required, _ = extract_required_kwarg(kwargs, state.subproject) if disabled: return ModuleReturnValue(False, [False]) name = args[0] lang, compiler = self._compiler(state) args = self._compile_args(compiler, state, kwargs) args += ('-l' + lib for lib in mesonlib.stringlistify(kwargs.get('libraries', []))) ok = compiler.has_function(name, '', state.environment, args, None) self._checklog('symbol', name, ok) self._set_config_var(state, ok, name, kwargs) if not ok and required: raise InterpreterException('{} symbol {} required but not found.'.format(lang, name)) return ModuleReturnValue(ok, [ok])