From 126d20db6ddc02b2718a8dff41f7ec364f873887 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pekka=20Kl=C3=A4rck?= Date: Thu, 19 Jan 2017 20:48:28 +0200 Subject: [PATCH] Building: rm __pycache__ when cleaning --- tasks.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tasks.py b/tasks.py index b0521971068..27f2791c507 100644 --- a/tasks.py +++ b/tasks.py @@ -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