From 0d26cbe54d2bf3cc7bc875843b347b858bc92080 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Tue, 24 Aug 2021 22:05:40 -0400 Subject: [PATCH] dependency: fallback and allow_fallback are mutually exclusive That used to abort in previous Meson versions but 0.59 stopped forbidding that by mistake. --- mesonbuild/interpreter/dependencyfallbacks.py | 2 ++ .../failing/114 allow_fallback with fallback/meson.build | 3 +++ .../failing/114 allow_fallback with fallback/test.json | 8 ++++++++ 3 files changed, 13 insertions(+) create mode 100644 test cases/failing/114 allow_fallback with fallback/meson.build create mode 100644 test cases/failing/114 allow_fallback with fallback/test.json diff --git a/mesonbuild/interpreter/dependencyfallbacks.py b/mesonbuild/interpreter/dependencyfallbacks.py index 5934cbd90..49cbfccc4 100644 --- a/mesonbuild/interpreter/dependencyfallbacks.py +++ b/mesonbuild/interpreter/dependencyfallbacks.py @@ -46,6 +46,8 @@ class DependencyFallbacksHolder(MesonInterpreterObject): mlog.warning('The "default_options" keyword argument does nothing without a fallback subproject.', location=self.interpreter.current_node) return + if self.allow_fallback is not None: + raise InvalidArguments('"fallback" and "allow_fallback" arguments are mutually exclusive') fbinfo = stringlistify(fbinfo) if len(fbinfo) == 0: # dependency('foo', fallback: []) is the same as dependency('foo', allow_fallback: false) diff --git a/test cases/failing/114 allow_fallback with fallback/meson.build b/test cases/failing/114 allow_fallback with fallback/meson.build new file mode 100644 index 000000000..2874e424c --- /dev/null +++ b/test cases/failing/114 allow_fallback with fallback/meson.build @@ -0,0 +1,3 @@ +project('fallback and allow_fallback') + +dependency('foo', fallback: 'foo', allow_fallback: false) diff --git a/test cases/failing/114 allow_fallback with fallback/test.json b/test cases/failing/114 allow_fallback with fallback/test.json new file mode 100644 index 000000000..1e5712e78 --- /dev/null +++ b/test cases/failing/114 allow_fallback with fallback/test.json @@ -0,0 +1,8 @@ +{ + "stdout": [ + { + "line": "test cases/failing/114 allow_fallback with fallback/meson.build:3:0: ERROR: \"fallback\" and \"allow_fallback\" arguments are mutually exclusive" + } + ] +} +