From b87067dc8ba5ade1a36f353c89b43b018e8c0cc4 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Thu, 16 Jun 2022 20:29:59 -0400 Subject: fix regression that broke proper warnings about passing subproject as a dep Regression in commit 7c757dff71c031ae02ecc358a69a213a5db4051a. SubprojectHolder is no longer an ObjectHolder and says so via a TODO: this means that we have to fiddle with held_object. Yay. --- mesonbuild/build.py | 3 +++ test cases/failing/127 subproject object as a dependency/test.json | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/mesonbuild/build.py b/mesonbuild/build.py index ea9b2c2..c987840 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -1373,6 +1373,9 @@ You probably should put it in link_with instead.''') # This is a bit of a hack. We do not want Build to know anything # about the interpreter so we can't import it and use isinstance. # This should be reliable enough. + if hasattr(dep, 'held_object'): + # FIXME: subproject is not a real ObjectHolder so we have to do this by hand + dep = dep.held_object if hasattr(dep, 'project_args_frozen') or hasattr(dep, 'global_args_frozen'): raise InvalidArguments('Tried to use subproject object as a dependency.\n' 'You probably wanted to use a dependency declared in it instead.\n' diff --git a/test cases/failing/127 subproject object as a dependency/test.json b/test cases/failing/127 subproject object as a dependency/test.json index af7310f..fdc85b3 100644 --- a/test cases/failing/127 subproject object as a dependency/test.json +++ b/test cases/failing/127 subproject object as a dependency/test.json @@ -1,7 +1,7 @@ { "stdout": [ { - "line": "test cases/failing/127 subproject object as a dependency/meson.build:3:0: ERROR: Argument is of an unacceptable type 'SubprojectHolder'." + "line": "test cases/failing/127 subproject object as a dependency/meson.build:3:0: ERROR: Tried to use subproject object as a dependency." } ] } -- cgit v1.1