diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 5c1d9d431..fa9e4f83d 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -667,7 +667,7 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta): dependencies: T.Optional[T.List['Dependency']] = None) -> T.Tuple[bool, bool]: raise EnvironmentException('Language %s does not support header symbol checks.' % self.get_display_language()) - def run(self, code: str, env: 'Environment', *, + def run(self, code: 'mesonlib.FileOrString', env: 'Environment', *, extra_args: T.Optional[T.List[str]] = None, dependencies: T.Optional[T.List['Dependency']] = None) -> RunResult: raise EnvironmentException('Language %s does not support run checks.' % self.get_display_language()) @@ -808,7 +808,7 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta): yield result @contextlib.contextmanager - def cached_compile(self, code: str, cdata: coredata.CoreData, *, + def cached_compile(self, code: 'mesonlib.FileOrString', cdata: coredata.CoreData, *, extra_args: T.Union[None, T.List[str], CompilerArgs] = None, mode: str = 'link', temp_dir: T.Optional[str] = None) -> T.Iterator[T.Optional[CompileResult]]: @@ -1200,7 +1200,7 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta): return args @contextlib.contextmanager - def _build_wrapper(self, code: str, env: 'Environment', + def _build_wrapper(self, code: 'mesonlib.FileOrString', env: 'Environment', extra_args: T.Union[None, CompilerArgs, T.List[str]] = None, dependencies: T.Optional[T.List['Dependency']] = None, mode: str = 'compile', want_output: bool = False, @@ -1219,7 +1219,7 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta): with self.cached_compile(code, env.coredata, extra_args=args, mode=mode, temp_dir=env.scratch_dir) as r: yield r - def compiles(self, code: str, env: 'Environment', *, + def compiles(self, code: 'mesonlib.FileOrString', env: 'Environment', *, extra_args: T.Union[None, T.List[str], CompilerArgs] = None, dependencies: T.Optional[T.List['Dependency']] = None, mode: str = 'compile', @@ -1228,7 +1228,7 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta): return p.returncode == 0, p.cached - def links(self, code: str, env: 'Environment', *, + def links(self, code: 'mesonlib.FileOrString', env: 'Environment', *, extra_args: T.Union[None, T.List[str], CompilerArgs] = None, dependencies: T.Optional[T.List['Dependency']] = None, mode: str = 'compile', diff --git a/mesonbuild/compilers/mixins/clike.py b/mesonbuild/compilers/mixins/clike.py index 09ad837b1..623a17a71 100644 --- a/mesonbuild/compilers/mixins/clike.py +++ b/mesonbuild/compilers/mixins/clike.py @@ -462,7 +462,7 @@ class CLikeCompiler(Compiler): args = cargs + extra_args + largs return args - def run(self, code: str, env: 'Environment', *, + def run(self, code: 'mesonlib.FileOrString', env: 'Environment', *, extra_args: T.Optional[T.List[str]] = None, dependencies: T.Optional[T.List['Dependency']] = None) -> compilers.RunResult: need_exe_wrapper = env.need_exe_wrapper(self.for_machine) diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index ea74e7c12..343651534 100644 --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -34,14 +34,14 @@ import typing as T if T.TYPE_CHECKING: from . import dependencies - from .compilers.compilers import Compiler, CompileResult # noqa: F401 + from .compilers.compilers import Compiler from .environment import Environment - from .mesonlib import OptionOverrideProxy + from .mesonlib import OptionOverrideProxy, FileOrString from .cmake.traceparser import CMakeCacheEntry OptionDictType = T.Union[T.Dict[str, 'UserOption[T.Any]'], OptionOverrideProxy] KeyedOptionDictType = T.Union[T.Dict['OptionKey', 'UserOption[T.Any]'], OptionOverrideProxy] - CompilerCheckCacheKey = T.Tuple[T.Tuple[str, ...], str, str, T.Tuple[str, ...], str] + CompilerCheckCacheKey = T.Tuple[T.Tuple[str, ...], str, 'FileOrString', T.Tuple[str, ...], str] version = '0.59.99' backendlist = ['ninja', 'vs', 'vs2010', 'vs2012', 'vs2013', 'vs2015', 'vs2017', 'vs2019', 'xcode']