From c3292f4dc1da02ebc0524e525f0ddb79a5d46332 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Mon, 8 Jul 2013 21:02:47 +0300 Subject: [PATCH] More use of logging framework. --- interpreter.py | 17 +++++++++-------- meson.py | 4 ++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/interpreter.py b/interpreter.py index 26806f63b..189fe85d7 100644 --- a/interpreter.py +++ b/interpreter.py @@ -635,7 +635,7 @@ class CompilerHolder(InterpreterObject): if not isinstance(prefix, str): raise InterpreterException('Prefix argument of sizeof must be a string.') esize = self.compiler.sizeof(element, prefix) - print('Checking for size of "%s": %d' % (element, esize)) + mlog.log('Checking for size of "%s": %d' % (element, esize)) return esize def compiles_method(self, args, kwargs): @@ -657,7 +657,11 @@ class CompilerHolder(InterpreterObject): if not isinstance(string, str): raise InterpreterException('Argument to has_header() must be a string') haz = self.compiler.has_header(string) - print('Has header "%s": %s.' % (string, str(haz))) + if haz: + h = mlog.green('YES') + else: + h = mlog.red('NO') + mlog.log('Has header "%s":' % string, h) return haz class MesonMain(InterpreterObject): @@ -809,8 +813,6 @@ class Interpreter(): actual = args[i] if wanted != None: if not isinstance(actual, wanted): - print(actual) - print(wanted) raise InvalidArguments('Incorrect argument type.') def func_run_command(self, node, args, kwargs): @@ -929,7 +931,7 @@ class Interpreter(): self.validate_arguments(args, 2, [str, Executable]) t = Test(args[0], args[1]) self.build.tests.append(t) - print('Adding test "%s"' % args[0]) + mlog.log('Adding test "', mlog.bold(args[0]), '".', sep='') def func_headers(self, node, args, kwargs): for a in args: @@ -967,7 +969,7 @@ class Interpreter(): except coredata.MesonException as me: me.file = buildfilename raise me - print('Going to subdirectory "%s".' % self.subdir) + mlog.log('Going to subdirectory "%s".' % self.subdir) self.evaluate_codeblock(codeblock) self.subdir = prev_subdir @@ -1054,7 +1056,7 @@ class Interpreter(): raise InvalidCode('Tried to create target "%s", but a target of that name already exists.' % name) l = targetclass(name, self.subdir, sources, self.environment, kwargs) self.build.targets[name] = l - print('Creating build target "%s" with %d files.' % (name, len(sources))) + mlog.log('Creating build target "', mlog.bold(name), '" with %d files.' % len(sources), sep='') return l def function_call(self, node): @@ -1159,7 +1161,6 @@ class Interpreter(): else: self.evaluate_codeblock(node.get_falseblock()) else: - print(node.get_clause()) raise InvalidCode('If clause does not evaluate to true or false.') def is_elementary_type(self, v): diff --git a/meson.py b/meson.py index 378590a82..0ea4cea5d 100755 --- a/meson.py +++ b/meson.py @@ -98,8 +98,8 @@ class MesonApp(): mlog.initialize(env.get_log_dir()) mlog.log(mlog.bold('The Meson build system')) mlog.log(' version:', coredata.version) - mlog.log('Source dir:', mlog.cyan(app.source_dir)) - mlog.log('Build dir:', mlog.cyan(app.build_dir)) + mlog.log('Source dir:', mlog.bold(app.source_dir)) + mlog.log('Build dir:', mlog.bold(app.build_dir)) b = build.Build(env) intr = interpreter.Interpreter(b) intr.run()