Commit 4f2fe1e0 authored by Shane Hathaway's avatar Shane Hathaway

Remove deleted files from the file list so walk() can continue.

parent ceef7bf6
...@@ -99,10 +99,10 @@ def walkandscrub(path): ...@@ -99,10 +99,10 @@ def walkandscrub(path):
print print
print '-'*78 print '-'*78
sys.stdout.write( sys.stdout.write(
"Deleting '.pyc' and '.pyo' files recursively under %s... " % path "Deleting '.pyc' and '.pyo' files recursively under %s...\n" % path
) )
os.path.walk(path, scrub, []) os.path.walk(path, scrub, [])
sys.stdout.write('done.\n') sys.stdout.write('Done.\n')
def scrub(list, dirname, filelist): def scrub(list, dirname, filelist):
for name in filelist: for name in filelist:
...@@ -112,6 +112,7 @@ def scrub(list, dirname, filelist): ...@@ -112,6 +112,7 @@ def scrub(list, dirname, filelist):
if ext == '.pyo' or ext == '.pyc': if ext == '.pyo' or ext == '.pyc':
full = os.path.join(dirname, name) full = os.path.join(dirname, name)
os.unlink(full) os.unlink(full)
filelist.remove(name)
if DEBUG: print full if DEBUG: print full
if __name__ == '__main__': if __name__ == '__main__':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment