Skip to content

Commit 126d20d

Browse files
committed
Building: rm __pycache__ when cleaning
1 parent 0b3f06c commit 126d20d

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

tasks.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,12 @@ def clean(ctx, remove_dist=True, create_dirs=False):
138138
shutil.rmtree(name)
139139
if create_dirs and not os.path.isdir(name):
140140
os.mkdir(name)
141-
for directory, _, files in os.walk('.'):
141+
for directory, dirs, files in os.walk('.'):
142142
for name in files:
143143
if name.endswith(('.pyc', '$py.class')):
144144
os.remove(os.path.join(directory, name))
145+
if '__pycache__' in dirs:
146+
shutil.rmtree(os.path.join(directory, '__pycache__'))
145147

146148

147149
@task

0 commit comments

Comments
 (0)