Commit 11ed5938 authored by Laurent Bachelier's avatar Laurent Bachelier 🐧 Committed by Romain Bignon
Browse files

Faster walk by excluding some directories

parent 133c83ed
......@@ -4,7 +4,14 @@
root = os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir))
verbose = '-v' in sys.argv
excludes = ('.git', '.svn', '__pycache__')
for dirpath, dirnames, filenames in os.walk(root):
for exclude in excludes:
try:
dirnames.remove(exclude)
except ValueError:
pass
for filename in filenames:
if filename.endswith('.pyc') or filename.endswith('pyo'):
if not os.path.exists(os.path.join(dirpath, filename[:-1])):
......
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