From 840784578784b40130bffa763ddd0a70f4487d1e Mon Sep 17 00:00:00 2001 From: Thomas Nagy Date: Sat, 28 May 2016 16:05:00 +0200 Subject: [PATCH] Provide a showcase for print_commands.py and remove some old code --- playground/display/wscript | 43 ++------------------------------------ 1 file changed, 2 insertions(+), 41 deletions(-) diff --git a/playground/display/wscript b/playground/display/wscript index d9f08d64..57775d33 100644 --- a/playground/display/wscript +++ b/playground/display/wscript @@ -1,8 +1,6 @@ #! /usr/bin/env python # encoding: utf-8 -# Thomas Nagy, 2011 (ita) - -import sys +# Thomas Nagy, 2016 (ita) def options(opt): opt.load('compiler_c') @@ -11,43 +9,6 @@ def configure(conf): conf.load('compiler_c') def build(bld): + bld.load('print_commands') bld.program(source='main.c', target='app') - customize_ze_outputs() - -def customize_ze_outputs(): - # first, display strings, people like them - from waflib import Utils, Logs - from waflib.Context import Context - def exec_command(self, cmd, **kw): - subprocess = Utils.subprocess - kw['shell'] = isinstance(cmd, str) - if isinstance(cmd, str): - Logs.info('%s' % cmd) - else: - Logs.info('%s' % ' '.join(cmd)) # here is the change - Logs.debug('runner_env: kw=%s' % kw) - try: - if self.logger: - self.logger.info(cmd) - kw['stdout'] = kw['stderr'] = subprocess.PIPE - p = subprocess.Popen(cmd, **kw) - (out, err) = p.communicate() - if out: - self.logger.debug('out: %s' % out.decode(sys.stdout.encoding or 'iso8859-1')) - if err: - self.logger.error('err: %s' % err.decode(sys.stdout.encoding or 'iso8859-1')) - return p.returncode - else: - p = subprocess.Popen(cmd, **kw) - return p.wait() - except OSError: - return -1 - Context.exec_command = exec_command - - # and change the outputs for tasks too - from waflib.Task import Task - def display(self): - return '' # no output on empty strings - Task.__str__ = display -