aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/backend/backends.py
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2023-01-17 01:46:35 -0500
committerEli Schwartz <eschwartz@archlinux.org>2023-06-26 13:10:32 -0400
commite715400d1bb41eae6c0df799beb4b27047f83bff (patch)
treec6d7d5434d77a138a01d9d6e5d5974612d71bb8b /mesonbuild/backend/backends.py
parent418063cc472aa12aca9253c3970486ca5a90b70e (diff)
downloadmeson-e715400d1bb41eae6c0df799beb4b27047f83bff.zip
meson-e715400d1bb41eae6c0df799beb4b27047f83bff.tar.gz
meson-e715400d1bb41eae6c0df799beb4b27047f83bff.tar.bz2
tree-wide: reduce unneeded imports on specific Dependency impls
We can check something's subtype using properties, without importing the module up front and doing isinstance checks on specific subclasses of the interface -- or worse, solving cyclic imports by doing the import inside the function. ;)
Diffstat (limited to 'mesonbuild/backend/backends.py')
-rw-r--r--mesonbuild/backend/backends.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index a13c0ec..14f03b1 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -740,7 +740,7 @@ class Backend:
srcdir = self.environment.get_source_dir()
for dep in target.external_deps:
- if not isinstance(dep, (dependencies.ExternalLibrary, dependencies.PkgConfigDependency)):
+ if dep.type_name not in {'library', 'pkgconfig'}:
continue
for libpath in dep.link_args:
# For all link args that are absolute paths to a library file, add RPATH args
@@ -1006,7 +1006,8 @@ class Backend:
continue
if compiler.language == 'vala':
- if isinstance(dep, dependencies.PkgConfigDependency):
+ if dep.type_name == 'pkgconfig':
+ assert isinstance(dep, dependencies.ExternalDependency)
if dep.name == 'glib-2.0' and dep.version_reqs is not None:
for req in dep.version_reqs:
if req.startswith(('>=', '==')):
@@ -1075,7 +1076,7 @@ class Backend:
results = set()
for dep in target.external_deps:
- if isinstance(dep, dependencies.PkgConfigDependency):
+ if dep.type_name == 'pkgconfig':
# If by chance pkg-config knows the bin dir...
bindir = dep.get_pkgconfig_variable('bindir', [], default='')
if bindir: