Revision 1166ea11785ce12cdfd5e8bf8b3a69b5e6b76f9c authored by Thom Wiggers on 07 December 2019, 13:31:06 UTC, committed by Eli Bendersky on 07 December 2019, 13:31:06 UTC
1 parent a4a7127
_clean_tables.py
# Cleanup all tables and PYC files to ensure no PLY stuff is cached
from __future__ import print_function
import itertools
import fnmatch
import os, shutil
file_patterns = ('yacctab.*', 'lextab.*', '*.pyc', '__pycache__')
def do_cleanup(root):
for path, dirs, files in os.walk(root):
for file in itertools.chain(dirs, files):
try:
for pattern in file_patterns:
if fnmatch.fnmatch(file, pattern):
fullpath = os.path.join(path, file)
if os.path.isdir(fullpath):
shutil.rmtree(fullpath, ignore_errors=False)
else:
os.unlink(fullpath)
print('Deleted', fullpath)
except OSError:
pass
if __name__ == "__main__":
do_cleanup('.')

Computing file changes ...