From c714fb08fdb4ec06d573bc9aa8647fa62fc182f1 Mon Sep 17 00:00:00 2001 From: Andrea Arteaga Date: Mon, 9 Apr 2012 21:22:28 +0200 Subject: Added -c / --clean switch. --- numbench/benchconfig.py | 10 +++++++++- numbench/main.py | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/numbench/benchconfig.py b/numbench/benchconfig.py index c7ff33b..244ac63 100644 --- a/numbench/benchconfig.py +++ b/numbench/benchconfig.py @@ -50,11 +50,19 @@ if not locals().has_key('initialized'): basedir = pjoin(curdir, passargs[i+1]) passargs = passargs[:i] + passargs[i+2:] break + + if a in ('-c', '--clean'): + clean = True + passargs = passargs[:i] + passargs[i+1:] + + # Clean flag + if not locals().has_key('clean'): + clean = False # Storage directories if not locals().has_key('basedir'): basedirb = pjoin(os.environ['HOME'], '.numbench') \ - + '/run_' + modulename + '_' + time.strftime('%Y-%m-%d') + + '/numbench_' + modulename + '_' + time.strftime('%Y-%m-%d') if os.path.exists(basedirb): n = 1 while True: diff --git a/numbench/main.py b/numbench/main.py index 6e9fb2c..acfe6d7 100644 --- a/numbench/main.py +++ b/numbench/main.py @@ -238,6 +238,10 @@ for tn,(name,test) in enumerate(cfg.tests.items(),1): # Save the results report.saveReport() +# Clean up the directories +if cfg.clean: + bu.rmdir(cfg.testsdir) + bu.rmdir(cfg.rootsdir) # TODO: reintroduce the instructions feature (and remove "exit) -- cgit v1.2.3-65-gdbad