cleanupSource.py

branch
6_1_x
changeset 5043
a4044e648b75
parent 4632
ca310db386ed
--- a/cleanupSource.py	Sun Jul 10 12:48:18 2016 +0200
+++ b/cleanupSource.py	Tue Jul 19 18:51:15 2016 +0200
@@ -35,10 +35,11 @@
             if os.path.exists(os.path.join(dirName, sourceName + "c")):
                 os.remove(os.path.join(dirName, sourceName + "c"))
     
-    # step 2: delete the __pycache__ directory and all *.pyc files
+    # step 2: delete the __pycache__ directory and all remaining *.pyc files
     if os.path.exists(os.path.join(dirName, "__pycache__")):
         shutil.rmtree(os.path.join(dirName, "__pycache__"))
-    for name in [f for f in dirListing if fnmatch.fnmatch(f, "*.pyc")]:
+    for name in [f for f in os.listdir(dirName)
+                 if fnmatch.fnmatch(f, "*.pyc")]:
         os.remove(os.path.join(dirName, name))
     
     # step 3: descent into subdirectories and delete them if empty

eric ide

mercurial