Tweak cleanup script to kill __pycache__ dirs as well.
diff --git a/_clean_tables.py b/_clean_tables.py
index ab7cfcb..155a820 100644
--- a/_clean_tables.py
+++ b/_clean_tables.py
@@ -1,5 +1,6 @@
# 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
@@ -8,12 +9,12 @@
def do_cleanup(root):
for path, dirs, files in os.walk(root):
- for file in files:
+ for file in itertools.chain(dirs, files):
try:
for pattern in file_patterns:
if fnmatch.fnmatch(file, pattern):
fullpath = os.path.join(path, file)
- os.remove(fullpath)
+ shutil.rmtree(fullpath, ignore_errors=True)
print('Deleted', fullpath)
except OSError:
pass