blob: f6853d48fb8a13da76fc404b159bdce362916bba [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
mbligh2392ee52007-10-11 19:34:13 +000024for dir in ['tests', 'profilers', 'deps']:
jadmanski0afbb632008-06-06 21:10:57 +000025 purge_src(dir)