summaryrefslogtreecommitdiff
path: root/mesonbuild/compilers
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2025-11-12 09:53:44 -0800
committerDylan Baker <dylan@pnwbakers.com>2025-11-19 10:48:48 -0800
commite8286ab9a102823cb256bd859de1a9082679e79b (patch)
treedd8d0a28523484878c920b46a891b2440f0b925a /mesonbuild/compilers
parentcd4293b54a624026dcbc289b22fde9ef37b8c7eb (diff)
downloadmeson-e8286ab9a102823cb256bd859de1a9082679e79b.tar.gz
compilers: Remove Environment parameter from Compiler.get_library_dirs
Diffstat (limited to 'mesonbuild/compilers')
-rw-r--r--mesonbuild/compilers/compilers.py3
-rw-r--r--mesonbuild/compilers/mixins/clike.py12
-rw-r--r--mesonbuild/compilers/mixins/elbrus.py2
3 files changed, 7 insertions, 10 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index 5486b5d7e..3ef45de8f 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -1171,8 +1171,7 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta):
# those features explicitly.
return []
- def get_library_dirs(self, env: 'Environment',
- elf_class: T.Optional[int] = None) -> T.List[str]:
+ def get_library_dirs(self, elf_class: T.Optional[int] = None) -> T.List[str]:
return []
def get_return_value(self,
diff --git a/mesonbuild/compilers/mixins/clike.py b/mesonbuild/compilers/mixins/clike.py
index 6967362b6..65933a6b5 100644
--- a/mesonbuild/compilers/mixins/clike.py
+++ b/mesonbuild/compilers/mixins/clike.py
@@ -193,10 +193,9 @@ class CLikeCompiler(Compiler):
return []
@functools.lru_cache()
- def _get_library_dirs(self, env: 'Environment',
- elf_class: T.Optional[int] = None) -> 'ImmutableListProtocol[str]':
+ def _get_library_dirs(self, elf_class: T.Optional[int] = None) -> 'ImmutableListProtocol[str]':
# TODO: replace elf_class with enum
- dirs = self.get_compiler_dirs(env, 'libraries')
+ dirs = self.get_compiler_dirs(self.environment, 'libraries')
if elf_class is None or elf_class == 0:
return dirs
@@ -232,12 +231,11 @@ class CLikeCompiler(Compiler):
return retval
- def get_library_dirs(self, env: 'Environment',
- elf_class: T.Optional[int] = None) -> T.List[str]:
+ def get_library_dirs(self, elf_class: T.Optional[int] = None) -> T.List[str]:
"""Wrap the lru_cache so that we return a new copy and don't allow
mutation of the cached value.
"""
- return self._get_library_dirs(env, elf_class).copy()
+ return self._get_library_dirs(elf_class).copy()
@functools.lru_cache()
def _get_program_dirs(self, env: 'Environment') -> 'ImmutableListProtocol[str]':
@@ -1163,7 +1161,7 @@ class CLikeCompiler(Compiler):
# Search in the specified dirs, and then in the system libraries
largs = self.get_linker_always_args() + self.get_allow_undefined_link_args()
lcargs = self.linker_to_compiler_args(largs)
- for d in itertools.chain(extra_dirs, [] if ignore_system_dirs else self.get_library_dirs(env, elf_class)):
+ for d in itertools.chain(extra_dirs, [] if ignore_system_dirs else self.get_library_dirs(elf_class)):
for p in patterns:
trials = self._get_trials_from_pattern(p, d, libname)
if not trials:
diff --git a/mesonbuild/compilers/mixins/elbrus.py b/mesonbuild/compilers/mixins/elbrus.py
index 7037db232..978a565ed 100644
--- a/mesonbuild/compilers/mixins/elbrus.py
+++ b/mesonbuild/compilers/mixins/elbrus.py
@@ -39,7 +39,7 @@ class ElbrusCompiler(GnuLikeCompiler):
# FIXME: use _build_wrapper to call this so that linker flags from the env
# get applied
- def get_library_dirs(self, env: 'Environment', elf_class: T.Optional[int] = None) -> T.List[str]:
+ def get_library_dirs(self, elf_class: T.Optional[int] = None) -> T.List[str]:
os_env = os.environ.copy()
os_env['LC_ALL'] = 'C'
stdo = Popen_safe(self.get_exelist(ccache=False) + ['--print-search-dirs'], env=os_env)[1]