From 7b3d00fee4bc76e9b6492321572db7ddd6d7f674 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Fri, 9 Dec 2016 12:47:14 +0530 Subject: Use dict for self.build.compilers instead of list Everywhere we use this object, we end up iterating over it and comparing compiler.get_language() with something. Using a dict is the obvious choice and simplifies a lot of code. --- mesonbuild/modules/windows.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'mesonbuild/modules/windows.py') diff --git a/mesonbuild/modules/windows.py b/mesonbuild/modules/windows.py index cd4e343..ad882cb 100644 --- a/mesonbuild/modules/windows.py +++ b/mesonbuild/modules/windows.py @@ -19,9 +19,9 @@ import os class WindowsModule: def detect_compiler(self, compilers): - for c in compilers: - if c.language == 'c' or c.language == 'cpp': - return c + for l in ('c', 'cpp'): + if l in compilers: + return compilers[l] raise MesonException('Resource compilation requires a C or C++ compiler.') def compile_resources(self, state, args, kwargs): -- cgit v1.1