cleanupSource.py

changeset 3613
47e29cc0f29c
parent 3597
137370f7114b
child 3670
f0cb7579c0b4
child 3949
1ce546a04f0a
--- a/cleanupSource.py	Sat May 24 17:11:12 2014 +0200
+++ b/cleanupSource.py	Sat May 24 18:01:53 2014 +0200
@@ -35,9 +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
+    # step 2: delete the __pycache__ directory and all *.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")]:
+        os.remove(os.path.join(dirName, name))
     
     # step 3: descent into subdirectories and delete them if empty
     for name in os.listdir(dirName):

eric ide

mercurial