From 068cb9db2a07c665cb55f68a70f42bb2b773e720 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Mon, 3 Nov 2025 09:04:39 -0800 Subject: compilers: Remove Environment parameter from Compiler.find_framework Which, ironically, is passed down three levels and never used. --- mesonbuild/compilers/compilers.py | 1 - mesonbuild/compilers/mixins/clike.py | 10 +++++----- mesonbuild/dependencies/framework.py | 2 +- mesonbuild/dependencies/platform.py | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 79771d04f..6ac9cc0f7 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -1186,7 +1186,6 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta): def find_framework(self, name: str, - env: 'Environment', extra_dirs: T.List[str], allow_system: bool = True) -> T.Optional[T.List[str]]: raise EnvironmentException(f'{self.id} does not support find_framework') diff --git a/mesonbuild/compilers/mixins/clike.py b/mesonbuild/compilers/mixins/clike.py index c53087467..495cb9b26 100644 --- a/mesonbuild/compilers/mixins/clike.py +++ b/mesonbuild/compilers/mixins/clike.py @@ -1234,7 +1234,7 @@ class CLikeCompiler(Compiler): paths.append(line[:-21].strip()) return paths - def _find_framework_real(self, name: str, env: 'Environment', extra_dirs: T.List[str], allow_system: bool) -> T.Optional[T.List[str]]: + def _find_framework_real(self, name: str, extra_dirs: T.List[str], allow_system: bool) -> T.Optional[T.List[str]]: code = 'int main(void) { return 0; }' link_args: T.List[str] = [] for d in extra_dirs: @@ -1247,7 +1247,7 @@ class CLikeCompiler(Compiler): return link_args return None - def _find_framework_impl(self, name: str, env: 'Environment', extra_dirs: T.List[str], + def _find_framework_impl(self, name: str, extra_dirs: T.List[str], allow_system: bool) -> T.Optional[T.List[str]]: if isinstance(extra_dirs, str): extra_dirs = [extra_dirs] @@ -1255,20 +1255,20 @@ class CLikeCompiler(Compiler): if key in self.find_framework_cache: value = self.find_framework_cache[key] else: - value = self._find_framework_real(name, env, extra_dirs, allow_system) + value = self._find_framework_real(name, extra_dirs, allow_system) self.find_framework_cache[key] = value if value is None: return None return value.copy() - def find_framework(self, name: str, env: 'Environment', extra_dirs: T.List[str], + def find_framework(self, name: str, extra_dirs: T.List[str], allow_system: bool = True) -> T.Optional[T.List[str]]: ''' Finds the framework with the specified name, and returns link args for the same or returns None when the framework is not found. ''' # TODO: should probably check for macOS? - return self._find_framework_impl(name, env, extra_dirs, allow_system) + return self._find_framework_impl(name, extra_dirs, allow_system) def get_crt_compile_args(self, crt_val: str, buildtype: str) -> T.List[str]: # TODO: does this belong here or in GnuLike or maybe PosixLike? diff --git a/mesonbuild/dependencies/framework.py b/mesonbuild/dependencies/framework.py index b0a26b30a..a23b4a66b 100644 --- a/mesonbuild/dependencies/framework.py +++ b/mesonbuild/dependencies/framework.py @@ -56,7 +56,7 @@ class ExtraFrameworkDependency(ExternalDependency): # Python.framework. We need to know for sure that the framework was # found in the path we expect. allow_system = p in self.system_framework_paths - args = self.clib_compiler.find_framework(framework_name, self.env, [p], allow_system) + args = self.clib_compiler.find_framework(framework_name, [p], allow_system) if args is None: continue self.link_args = args diff --git a/mesonbuild/dependencies/platform.py b/mesonbuild/dependencies/platform.py index 29631576a..49ec980b2 100644 --- a/mesonbuild/dependencies/platform.py +++ b/mesonbuild/dependencies/platform.py @@ -26,7 +26,7 @@ class AppleFrameworks(ExternalDependency): self.is_found = True for f in self.frameworks: try: - args = self.clib_compiler.find_framework(f, env, []) + args = self.clib_compiler.find_framework(f, []) except MesonException as e: if 'non-clang' in str(e): self.is_found = False -- cgit v1.2.3