blob: 7f7bd33d7d9c2bb1d4c93847e5866598a470fad7 [file] [log] [blame]
mbligh8fc0e5a2007-10-11 18:39:03 +00001#!/usr/bin/python
2import os
3
4def purge_src(top_dir):
jadmanski0afbb632008-06-06 21:10:57 +00005 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
mbligh8fc0e5a2007-10-11 18:39:03 +000019
jadmanski0afbb632008-06-06 21:10:57 +000020 print cmd
21 os.system(cmd)
mbligh8fc0e5a2007-10-11 18:39:03 +000022
23
mbligh6fd44282009-06-08 16:44:30 +000024os.system('cd tmp && ls -A | xargs rm -rf')
25
mbligh2392ee52007-10-11 19:34:13 +000026for dir in ['tests', 'profilers', 'deps']:
jadmanski0afbb632008-06-06 21:10:57 +000027 purge_src(dir)