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): |
jadmanski | 0afbb63 | 2008-06-06 21:10:57 +0000 | [diff] [blame] | 5 | for dir in os.listdir(top_dir): |
| 6 | if dir.startswith('.'): |
| 7 | continue |
| 8 | py = os.path.join (top_dir, dir, dir + '.py') |
| 9 | if not os.path.exists(py): |
| 10 | continue |
| 11 | ret = os.system('grep -q "preserve_srcdir = " ' + py) |
| 12 | src_path = os.path.abspath(os.path.join('tests', dir, 'src')) |
| 13 | if not os.path.exists(src_path): |
| 14 | continue |
| 15 | if ret: # This should have a replaceable src dir |
| 16 | cmd = 'rm -rf ' + src_path |
| 17 | else: |
| 18 | cmd = 'cd %s; make clean > /dev/null 2>&1 ' % src_path |
mbligh | 8fc0e5a | 2007-10-11 18:39:03 +0000 | [diff] [blame] | 19 | |
jadmanski | 0afbb63 | 2008-06-06 21:10:57 +0000 | [diff] [blame] | 20 | print cmd |
| 21 | os.system(cmd) |
mbligh | 8fc0e5a | 2007-10-11 18:39:03 +0000 | [diff] [blame] | 22 | |
| 23 | |
mbligh | 6fd4428 | 2009-06-08 16:44:30 +0000 | [diff] [blame^] | 24 | os.system('cd tmp && ls -A | xargs rm -rf') |
| 25 | |
mbligh | 2392ee5 | 2007-10-11 19:34:13 +0000 | [diff] [blame] | 26 | for dir in ['tests', 'profilers', 'deps']: |
jadmanski | 0afbb63 | 2008-06-06 21:10:57 +0000 | [diff] [blame] | 27 | purge_src(dir) |