diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2020-02-18 14:12:14 -0800 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2020-02-21 05:15:25 +0530 |
commit | cd30216ce405a565751e71f17ea4f7c1f85d5082 (patch) | |
tree | 2e0578bb60001602690ad01a3ebfa7bdeb9b81bd | |
parent | 4597235f924fa931a3376814ae76db7e150ded58 (diff) | |
download | meson-cd30216ce405a565751e71f17ea4f7c1f85d5082.zip meson-cd30216ce405a565751e71f17ea4f7c1f85d5082.tar.gz meson-cd30216ce405a565751e71f17ea4f7c1f85d5082.tar.bz2 |
compilers/compilers: Fix get_linker_id
Which could raise an AttributeError when used on languages like Java and
C# that don't have separate compilers and linkers.
-rw-r--r-- | mesonbuild/compilers/compilers.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index e8e72cf..0e52a82 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -724,7 +724,13 @@ class Compiler: return self.id def get_linker_id(self) -> str: - return self.linker.id + # There is not guarantee that we have a dynamic linker instance, as + # some languages don't have separate linkers and compilers. In those + # cases return the compiler id + try: + return self.linker.id + except AttributeError: + return self.id def get_version_string(self) -> str: details = [self.id, self.version] |