mbligh | 8fc0e5a | 2007-10-11 18:39:03 +0000 | [diff] [blame] | 1 | #!/usr/bin/python |
| 2 | import os |
| 3 | |
| 4 | def purge_src(top_dir): |
mbligh | 94bdda0 | 2009-09-02 19:26:28 +0000 | [diff] [blame] | 5 | if not os.path.exists(top_dir): |
| 6 | return |
jadmanski | 0afbb63 | 2008-06-06 21:10:57 +0000 | [diff] [blame] | 7 | for dir in os.listdir(top_dir): |
| 8 | if dir.startswith('.'): |
| 9 | continue |
| 10 | py = os.path.join (top_dir, dir, dir + '.py') |
| 11 | if not os.path.exists(py): |
| 12 | continue |
| 13 | ret = os.system('grep -q "preserve_srcdir = " ' + py) |
| 14 | src_path = os.path.abspath(os.path.join('tests', dir, 'src')) |
| 15 | if not os.path.exists(src_path): |
| 16 | continue |
| 17 | if ret: # This should have a replaceable src dir |
| 18 | cmd = 'rm -rf ' + src_path |
| 19 | else: |
| 20 | cmd = 'cd %s; make clean > /dev/null 2>&1 ' % src_path |
mbligh | 8fc0e5a | 2007-10-11 18:39:03 +0000 | [diff] [blame] | 21 | |
mbligh | d0e9498 | 2009-07-11 00:15:18 +0000 | [diff] [blame] | 22 | print 'Cleaning %s test dir' % dir |
jadmanski | 0afbb63 | 2008-06-06 21:10:57 +0000 | [diff] [blame] | 23 | os.system(cmd) |
mbligh | 8fc0e5a | 2007-10-11 18:39:03 +0000 | [diff] [blame] | 24 | |
mbligh | ef8f1f3 | 2010-01-08 01:07:42 +0000 | [diff] [blame^] | 25 | if os.path.isdir('tmp'): |
| 26 | os.system('cd tmp && ls -A | xargs rm -rf') |
mbligh | 6fd4428 | 2009-06-08 16:44:30 +0000 | [diff] [blame] | 27 | |
mbligh | 94bdda0 | 2009-09-02 19:26:28 +0000 | [diff] [blame] | 28 | for dir in ['site_tests', 'site_profilers', 'tests', 'profilers', 'deps']: |
jadmanski | 0afbb63 | 2008-06-06 21:10:57 +0000 | [diff] [blame] | 29 | purge_src(dir) |