From f2673d9b57d0134c293e7acf5af5a0b3364523fb Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Fri, 18 May 2018 20:50:03 +0100 Subject: Consolidate reporting result of a dependency check If successful, we should identify the method which was successful If successful, we should report the version found (if known) If failing, we should identify the methods we tried Some dependency detectors which had no reporting now gain it There's all kinds of complexities, inconsistencies and special cases hidden in the existing behaviour, e.g.: - boost reports modules requested, and BOOST_ROOT (if set) - gtest/gmock report if they are a prebuilt library or header only - mpi reports the language - qt reports modules requested, and the config tool used or tried - configtool reports the config tool used - llvm reports if missing modules are optional (one per line) We add some simple hooks to allow the dependency object to expose the currently reported information into the consolidated reporting Note that PkgConfigDependency() takes a silent: keyword which is used internallly to suppress reporting. This behaviour isn't needed in find_external_dependency(). --- mesonbuild/dependencies/boost.py | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'mesonbuild/dependencies/boost.py') diff --git a/mesonbuild/dependencies/boost.py b/mesonbuild/dependencies/boost.py index 7acde2d..17f9240 100644 --- a/mesonbuild/dependencies/boost.py +++ b/mesonbuild/dependencies/boost.py @@ -132,7 +132,6 @@ class BoostDependency(ExternalDependency): self.incdir = self.detect_nix_incdir() if self.check_invalid_modules(): - self.log_fail() return mlog.debug('Boost library root dir is', mlog.bold(self.boost_root)) @@ -146,12 +145,6 @@ class BoostDependency(ExternalDependency): self.detect_lib_modules() mlog.debug('Boost library directory is', mlog.bold(self.libdir)) - # 3. Report success or failure - if self.is_found: - self.log_success() - else: - self.log_fail() - def check_invalid_modules(self): invalid_modules = [c for c in self.requested_modules if 'boost_' + c not in BOOST_LIBS] @@ -172,17 +165,14 @@ class BoostDependency(ExternalDependency): else: return False - def log_fail(self): + def log_details(self): module_str = ', '.join(self.requested_modules) - mlog.log("Dependency Boost (%s) found:" % module_str, mlog.red('NO')) + return module_str - def log_success(self): - module_str = ', '.join(self.requested_modules) + def log_info(self): if self.boost_root: - info = self.version + ', ' + self.boost_root - else: - info = self.version - mlog.log('Dependency Boost (%s) found:' % module_str, mlog.green('YES'), info) + return self.boost_root + return '' def detect_nix_roots(self): return [os.path.abspath(os.path.join(x, '..')) -- cgit v1.1