Skip to content

Commit

Permalink
Building: rm __pycache__ when cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
pekkaklarck committed Jan 19, 2017
1 parent 0b3f06c commit 126d20d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tasks.py
Expand Up @@ -138,10 +138,12 @@ def clean(ctx, remove_dist=True, create_dirs=False):
shutil.rmtree(name)
if create_dirs and not os.path.isdir(name):
os.mkdir(name)
for directory, _, files in os.walk('.'):
for directory, dirs, files in os.walk('.'):
for name in files:
if name.endswith(('.pyc', '$py.class')):
os.remove(os.path.join(directory, name))
if '__pycache__' in dirs:
shutil.rmtree(os.path.join(directory, '__pycache__'))


@task
Expand Down

0 comments on commit 126d20d

Please sign in to comment.