diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2022-06-03 09:10:08 -0700 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2022-06-08 23:19:09 +0300 |
commit | 629a9c68e26652dcd1649a46e7b2729404cb2b40 (patch) | |
tree | 76ee234a5883369c5e121fb613a0c8d6c5a90216 | |
parent | f235b814c3a60095e2a086ef5e8b1d775318415d (diff) | |
download | meson-629a9c68e26652dcd1649a46e7b2729404cb2b40.zip meson-629a9c68e26652dcd1649a46e7b2729404cb2b40.tar.gz meson-629a9c68e26652dcd1649a46e7b2729404cb2b40.tar.bz2 |
build: use inheritance properly for is_internal
Calling `isinstance(self, X)` is an anti-pattern, we should just be using
inheritance for this, letting the `StaticLibrary` override the method, and
having the base class always return `False`.
-rw-r--r-- | mesonbuild/build.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 05a3cea..d80672e 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -1398,7 +1398,7 @@ You probably should put it in link_with instead.''') return self.external_deps def is_internal(self) -> bool: - return isinstance(self, StaticLibrary) and not self.need_install + return False def link(self, target): for t in listify(target): @@ -2002,6 +2002,9 @@ class StaticLibrary(BuildTarget): def is_linkable_target(self): return True + def is_internal(self) -> bool: + return not self.need_install + class SharedLibrary(BuildTarget): known_kwargs = known_shlib_kwargs |