diff options
author | Lyude Paul <lyude@redhat.com> | 2017-10-23 15:37:06 -0400 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2017-10-29 01:56:57 +0300 |
commit | 1a159db8e90fa6b9571a06768d6f1ba08074e819 (patch) | |
tree | ad68a408fe39d115c84f04ab435f25e419011be1 /mesonbuild/build.py | |
parent | 6e406ed0dbd326728240237391e18b0726753b4b (diff) | |
download | meson-1a159db8e90fa6b9571a06768d6f1ba08074e819.zip meson-1a159db8e90fa6b9571a06768d6f1ba08074e819.tar.gz meson-1a159db8e90fa6b9571a06768d6f1ba08074e819.tar.bz2 |
Raise InvalidArguments when trying to link against strings
With executable(), if the link_with argument has a string as one of it's
elements, meson ends up throwing an AttributeError exception:
...
File "/home/lyudess/Projects/meson/mesonbuild/build.py", line 868, in link
if not t.is_linkable_target():
AttributeError: 'str' object has no attribute 'is_linkable_target'
Which is not very helpful in figuring out where exactly the project is
trying to link against a string instead of an actual link target. So,
fix this by verifying in BuildTarget.link() that each given target is
actually a Target object and not something else.
Additionally, add a simple test case for this in failing tests. At the
moment, this test case just passes unconditionally due to meson throwing
the AttributeError exception and failing as expected. However, this test
case will be useful eventually if we ever end up making failing tests
more strict about failing gracefully (per advice of QuLogic).
Diffstat (limited to 'mesonbuild/build.py')
-rw-r--r-- | mesonbuild/build.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 2a71b8b..2840f29 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -863,6 +863,8 @@ You probably should put it in link_with instead.''') def link(self, target): for t in listify(target, unholder=True): + if not isinstance(t, Target): + raise InvalidArguments('{!r} is not a target.'.format(t)) if not t.is_linkable_target(): raise InvalidArguments('Link target {!r} is not linkable.'.format(t)) if isinstance(self, SharedLibrary) and isinstance(t, StaticLibrary) and not t.pic: |