[Checkins] SVN: zc.recipe.deployment/trunk/src/zc/recipe/deployment.py Fix directory removal code to deal with the possibility that removing

Amos Latteier amos at latteier.com
Tue Dec 5 18:24:46 EST 2006


Log message for revision 71428:
  Fix directory removal code to deal with the possibility that removing 
  directories may fail.
  

Changed:
  U   zc.recipe.deployment/trunk/src/zc/recipe/deployment.py

-=-
Modified: zc.recipe.deployment/trunk/src/zc/recipe/deployment.py
===================================================================
--- zc.recipe.deployment/trunk/src/zc/recipe/deployment.py	2006-12-05 22:35:54 UTC (rev 71427)
+++ zc.recipe.deployment/trunk/src/zc/recipe/deployment.py	2006-12-05 23:24:45 UTC (rev 71428)
@@ -57,10 +57,14 @@
                 if not os.path.isdir(d):
                     self.make_dirs(d, uid, gid, created)
             return created
-        except:
+        except Exception, e:
             for d in created:
-                shutil.rmtree(d)
-            raise
+                try:
+                    shutil.rmtree(d)
+                except OSError:
+                    # parent directory may have already been removed
+                    pass
+            raise e
 
     def update(self):
         pass



More information about the Checkins mailing list