diff options
author | Eli Bendersky <eliben@gmail.com> | 2015-12-12 14:45:07 -0800 |
---|---|---|
committer | Eli Bendersky <eliben@gmail.com> | 2015-12-12 14:45:07 -0800 |
commit | dbb018e302ae1946afec6afb481817cd42939079 (patch) | |
tree | 54b9d5f6d999e5c00474633a24172542b4c2d4c1 /_clean_tables.py | |
parent | 914f385a392f954d7fbd327e16cbd8ca73798293 (diff) | |
download | pycparser-dbb018e302ae1946afec6afb481817cd42939079.tar.gz |
Fix up _clean_tables.py to remove files and not only dirs
Diffstat (limited to '_clean_tables.py')
-rw-r--r-- | _clean_tables.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/_clean_tables.py b/_clean_tables.py index 155a820..5b0f1c3 100644 --- a/_clean_tables.py +++ b/_clean_tables.py @@ -14,7 +14,10 @@ def do_cleanup(root): for pattern in file_patterns: if fnmatch.fnmatch(file, pattern): fullpath = os.path.join(path, file) - shutil.rmtree(fullpath, ignore_errors=True) + if os.path.isdir(fullpath): + shutil.rmtree(fullpath, ignore_errors=False) + else: + os.unlink(fullpath) print('Deleted', fullpath) except OSError: pass |