aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers
diff options
context:
space:
mode:
authorTristan Partin <tristan@partin.io>2024-04-25 14:37:05 -0500
committerEli Schwartz <eschwartz93@gmail.com>2024-04-25 18:49:57 -0400
commitcb1068a28807687853934bb78ecc30746ebf8ea9 (patch)
tree49ada55156e9cb1818d5dccc26df87eece8a3100 /mesonbuild/compilers
parenta2ac3bc453c22c89ed7343f16b2848f81b73cb85 (diff)
downloadmeson-cb1068a28807687853934bb78ecc30746ebf8ea9.zip
meson-cb1068a28807687853934bb78ecc30746ebf8ea9.tar.gz
meson-cb1068a28807687853934bb78ecc30746ebf8ea9.tar.bz2
Catch Python exception in the event alignment can't be converted to int
The user almost certainly has to be using a compiler wrapper script that doesn't actually work if we land here. Fixes: #12982
Diffstat (limited to 'mesonbuild/compilers')
-rw-r--r--mesonbuild/compilers/mixins/clike.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/mesonbuild/compilers/mixins/clike.py b/mesonbuild/compilers/mixins/clike.py
index ac2344b..d273015 100644
--- a/mesonbuild/compilers/mixins/clike.py
+++ b/mesonbuild/compilers/mixins/clike.py
@@ -625,9 +625,17 @@ class CLikeCompiler(Compiler):
raise mesonlib.EnvironmentException('Could not compile alignment test.')
if res.returncode != 0:
raise mesonlib.EnvironmentException('Could not run alignment test binary.')
- align = int(res.stdout)
+
+ align: int
+ try:
+ align = int(res.stdout)
+ except ValueError:
+ # If we get here, the user is most likely using a script that is
+ # pretending to be a compiler.
+ raise mesonlib.EnvironmentException('Could not run alignment test binary.')
if align == 0:
raise mesonlib.EnvironmentException(f'Could not determine alignment of {typename}. Sorry. You might want to file a bug.')
+
return align, res.cached
def get_define(self, dname: str, prefix: str, env: 'Environment',