diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2025-10-07 16:04:32 +0200 |
|---|---|---|
| committer | Jussi Pakkanen <jussi.pakkanen@mailbox.org> | 2025-10-29 18:59:30 +0200 |
| commit | 10cc5d9ceef64a536c301eb3bdfa3584568aa8dc (patch) | |
| tree | 00696aff91cc155fa8bb9dd599907b6d9d142a59 /mesonbuild | |
| parent | 855af6f69ad0bc87c1d898688286265138c36061 (diff) | |
| download | meson-10cc5d9ceef64a536c301eb3bdfa3584568aa8dc.tar.gz | |
environment, compilers: move is_library caching to the source
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'mesonbuild')
| -rw-r--r-- | mesonbuild/compilers/compilers.py | 11 | ||||
| -rw-r--r-- | mesonbuild/environment.py | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 624226d33..c50c6229c 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -173,16 +173,19 @@ def is_object(fname: 'mesonlib.FileOrString') -> bool: fname = fname.fname return cached_is_object_by_name(fname) -def is_library(fname: 'mesonlib.FileOrString') -> bool: - if isinstance(fname, mesonlib.File): - fname = fname.fname - +@lru_cache(maxsize=None) +def cached_is_library_by_name(fname: str) -> bool: if soregex.match(fname): return True suffix = fname.split('.')[-1] return suffix in lib_suffixes +def is_library(fname: 'mesonlib.FileOrString') -> bool: + if isinstance(fname, mesonlib.File): + fname = fname.fname + return cached_is_library_by_name(fname) + def is_known_suffix(fname: 'mesonlib.FileOrString') -> bool: if isinstance(fname, mesonlib.File): fname = fname.fname diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index fe364442e..dd6938366 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -38,7 +38,6 @@ from .compilers import ( is_source, ) -from functools import lru_cache from mesonbuild import envconfig if T.TYPE_CHECKING: @@ -953,7 +952,6 @@ class Environment: def is_object(self, fname: 'mesonlib.FileOrString') -> bool: return is_object(fname) - @lru_cache(maxsize=None) def is_library(self, fname: mesonlib.FileOrString) -> bool: return is_library(fname) |
