From c3d143298be0afb8f7a3e75f7d1058d8ed638ee3 Mon Sep 17 00:00:00 2001 From: Jan Niklas Hasse Date: Fri, 3 Nov 2017 17:09:32 +0100 Subject: Log instead of raise if Boost module invalid BOOST_LIBS could become outdated in future versions, which would result in dependency('boost', modules : [ 'foo' ], required : false) to fail, although required was set to false. Therefore turn the exception into log_fail(). If required was set to true, this will still be caught since is_found remains False. This also improves logging by printing all invalid module names instead of only the first one. --- mesonbuild/dependencies/misc.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'mesonbuild/dependencies/misc.py') diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index e65675b..eb20085 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -66,6 +66,11 @@ class BoostDependency(ExternalDependency): self.is_multithreading = threading == "multi" self.requested_modules = self.get_requested(kwargs) + invalid_modules = [c for c in self.requested_modules if 'boost_' + c not in BOOST_LIBS] + if invalid_modules: + mlog.debug('Invalid Boost modules: ' + ', '.join(invalid_modules)) + self.log_fail() + return self.boost_root = None self.boost_roots = [] @@ -198,8 +203,6 @@ class BoostDependency(ExternalDependency): for c in candidates: if not isinstance(c, str): raise DependencyException('Boost module argument is not a string.') - if 'boost_' + c not in BOOST_LIBS: - raise DependencyException('Dependency {} not found. It is not a valid boost library.'.format(c)) return candidates def validate_requested(self): -- cgit v1.1