blob: 48417b0d61c53457021bb449b0056bc2c73bc3c9 [file] [log] [blame]
eli.bendersky49f3b632011-10-31 06:38:41 +02001# Cleanup all table and PYC files to ensure no PLY stuff is cached
2#
3import fnmatch
4import os, shutil
5
6file_patterns = ('yacctab.*', 'lextab.*', '*.pyc')
7
8def do_cleanup(root):
9 for path, dirs, files in os.walk(root):
10 for file in files:
11 try:
12 for pattern in file_patterns:
13 if fnmatch.fnmatch(file, pattern):
14 fullpath = os.path.join(path, file)
15 os.remove(fullpath)
16 print 'Deleted', fullpath
17 except OSError:
18 pass
19
20if __name__ == "__main__":
21 do_cleanup('.')
22
23
24