From 9c349cf6521b4b646f8e45a474c1d8dc521dc981 Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Sat, 13 Nov 2010 01:55:07 -0800 Subject: [PATCH] Fix log() output so you can cut-and-paste it verbatim into a command line. It used to say: redo: t/all redo: hello and now it says: redo t/all redo t/hello ie. there's no colon, and the path is intact. That means if the build fails, you can cut-and-paste 'redo t/hello', add a -v, and try to debug what went wrong. --- helpers.py | 4 ++-- redo.py | 4 ++-- vars.py | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/helpers.py b/helpers.py index 4ae9757..d72a944 100644 --- a/helpers.py +++ b/helpers.py @@ -48,10 +48,10 @@ def _log(s): def _clog(s): if vars.VERBOSE: _log('\n') - _log('\x1b[32mredo: %s\x1b[1m%s\x1b[m' % (vars.DEPTH, s)) + _log('\x1b[32mredo %s\x1b[1m%s\x1b[m' % (vars.DEPTH, s)) def _bwlog(s): if vars.VERBOSE: _log('\n') - _log('redo: %s%s' % (vars.DEPTH, s)) + _log('redo %s%s' % (vars.DEPTH, s)) def _cerr(s): _log('\x1b[31mredo: %s\x1b[1m%s\x1b[m' % (vars.DEPTH, s)) diff --git a/redo.py b/redo.py index f1c3097..a48edde 100755 --- a/redo.py +++ b/redo.py @@ -28,6 +28,7 @@ if not os.environ.get('REDO_BASE', ''): base = newbase break os.environ['REDO_BASE'] = base + os.environ['REDO_STARTDIR'] = os.getcwd() import vars from helpers import * @@ -90,11 +91,10 @@ def build(t): os.path.basename(t), 'FIXME', os.path.basename(tmpname)] if vars.VERBOSE: argv[1] += 'v' - log('%s\n' % t) + log('%s\n' % relpath(t, vars.STARTDIR)) rv = subprocess.call(argv, preexec_fn=lambda: _preexec(t), stdout=f.fileno()) st = os.stat(tmpname) - #log('rv: %d (%d bytes) (%r)\n' % (rv, st.st_size, dofile)) stampfile = sname('stamp', t) if rv==0: if st.st_size: diff --git a/vars.py b/vars.py index ca048ff..6bc5e38 100644 --- a/vars.py +++ b/vars.py @@ -4,6 +4,7 @@ TARGET = os.environ.get('REDO_TARGET', '') DEPTH = os.environ.get('REDO_DEPTH', '') DEBUG = os.environ.get('REDO_DEBUG', '') and 1 or 0 VERBOSE = os.environ.get('REDO_VERBOSE', '') and 1 or 0 +STARTDIR = os.environ.get('REDO_STARTDIR', '') BASE = os.environ.get('REDO_BASE', '') if BASE: BASE = os.path.abspath(BASE)