aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/environment.py
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2022-09-11 18:35:02 -0400
committerEli Schwartz <eschwartz@archlinux.org>2022-09-19 15:18:59 -0400
commit0a9048e5546c17a926fd199ded798fba0f76b036 (patch)
tree0d6eb84d073fc271e39e178c49ef3b4afc922746 /mesonbuild/environment.py
parent24ac3cdb9c403fa43553cece086666f48ece1b95 (diff)
downloadmeson-0a9048e5546c17a926fd199ded798fba0f76b036.zip
meson-0a9048e5546c17a926fd199ded798fba0f76b036.tar.gz
meson-0a9048e5546c17a926fd199ded798fba0f76b036.tar.bz2
compilers: don't use instance checks to determine properties
In various situations we want to figure out what type of compiler we have, because we want to know stuff like "is it the pgi one", or "does it use msvc style". The compiler object has this property already, via an API specifically designed to communicate this info, but instead we performed isinstance checks on a compiler class. This is confusing and indirect, and has the side effect of requiring more imports everywhere. We should do away with it.
Diffstat (limited to 'mesonbuild/environment.py')
-rw-r--r--mesonbuild/environment.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index 6ac7604..394b080 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -845,10 +845,10 @@ class Environment:
def get_compiler_system_dirs(self, for_machine: MachineChoice):
for comp in self.coredata.compilers[for_machine].values():
- if isinstance(comp, compilers.ClangCompiler):
+ if comp.id == 'clang':
index = 1
break
- elif isinstance(comp, compilers.GnuCompiler):
+ elif comp.id == 'gcc':
index = 2
break
else: