blob: cc63442c46e0bff01b30000122f7e632bc59f196 [file] [log] [blame]
mbligh8fc0e5a2007-10-11 18:39:03 +00001#!/usr/bin/python
2import os
3
4def purge_src(top_dir):
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
19
20 print cmd
21 os.system(cmd)
22
23
24purge_src('tests')
25purge_src('profilers')
26