diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2020-09-09 19:51:28 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-09 19:51:28 +0300 |
commit | 8d54b7bda30062569c981b50a85a175565a7c15a (patch) | |
tree | ed1ef8e4b6d3e2f41a8ca18edc78fa879cb26347 /mesonbuild/ast | |
parent | 4ed5c3acbf4ff4111bc9db1370d0818ad4648f5c (diff) | |
parent | 461c14b8b77abe3ef4802880c2b736ea2419961f (diff) | |
download | meson-8d54b7bda30062569c981b50a85a175565a7c15a.zip meson-8d54b7bda30062569c981b50a85a175565a7c15a.tar.gz meson-8d54b7bda30062569c981b50a85a175565a7c15a.tar.bz2 |
Merge pull request #7428 from jon-turney/introspector-add-languages
Handle add_languages(native:) in introspector
Diffstat (limited to 'mesonbuild/ast')
-rw-r--r-- | mesonbuild/ast/introspection.py | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/mesonbuild/ast/introspection.py b/mesonbuild/ast/introspection.py index 6e6927f..009fdb0 100644 --- a/mesonbuild/ast/introspection.py +++ b/mesonbuild/ast/introspection.py @@ -123,7 +123,8 @@ class IntrospectionInterpreter(AstInterpreter): options = {k: v for k, v in self.environment.meson_options.host[''].items() if k.startswith('backend_')} self.coredata.set_options(options) - self.func_add_languages(None, proj_langs, None) + self._add_languages(proj_langs, MachineChoice.HOST) + self._add_languages(proj_langs, MachineChoice.BUILD) def do_subproject(self, dirname: str) -> None: subproject_dir_abs = os.path.join(self.environment.get_source_dir(), self.subproject_dir) @@ -137,17 +138,25 @@ class IntrospectionInterpreter(AstInterpreter): return def func_add_languages(self, node: BaseNode, args: T.List[TYPE_nvar], kwargs: T.Dict[str, TYPE_nvar]) -> None: - args = self.flatten_args(args) - for for_machine in [MachineChoice.BUILD, MachineChoice.HOST]: - for lang in sorted(args, key=compilers.sort_clink): - if isinstance(lang, StringNode): - assert isinstance(lang.value, str) - lang = lang.value - if not isinstance(lang, str): - continue - lang = lang.lower() - if lang not in self.coredata.compilers[for_machine]: - self.environment.detect_compiler_for(lang, for_machine) + kwargs = self.flatten_kwargs(kwargs) + if 'native' in kwargs: + native = kwargs.get('native', False) + self._add_languages(args, MachineChoice.BUILD if native else MachineChoice.HOST) + else: + for for_machine in [MachineChoice.BUILD, MachineChoice.HOST]: + self._add_languages(args, for_machine) + + def _add_languages(self, langs: T.List[TYPE_nvar], for_machine: MachineChoice) -> None: + langs = self.flatten_args(langs) + for lang in sorted(langs, key=compilers.sort_clink): + if isinstance(lang, StringNode): + assert isinstance(lang.value, str) + lang = lang.value + if not isinstance(lang, str): + continue + lang = lang.lower() + if lang not in self.coredata.compilers[for_machine]: + self.environment.detect_compiler_for(lang, for_machine) def func_dependency(self, node: BaseNode, args: T.List[TYPE_nvar], kwargs: T.Dict[str, TYPE_nvar]) -> None: args = self.flatten_args(args) |