]> granicus.if.org Git - python/commitdiff
Catch errors from 'rmtree' and emit a warning.
authorGreg Ward <gward@python.net>
Thu, 16 Dec 1999 01:14:15 +0000 (01:14 +0000)
committerGreg Ward <gward@python.net>
Thu, 16 Dec 1999 01:14:15 +0000 (01:14 +0000)
Lib/distutils/command/dist.py

index 2e4aacddfc03f70abab09489a9c097573aeb906f..9931e3752d80281b19687561bb58bd62d8330bc3 100644 (file)
@@ -402,8 +402,16 @@ class Dist (Command):
 
 
     def nuke_release_tree (self, base_dir):
-        self.execute (rmtree, (base_dir,),
-                      "removing %s" % base_dir)
+        try:
+            self.execute (rmtree, (base_dir,),
+                          "removing %s" % base_dir)
+        except (IOError, OSError), exc:
+            if exc.filename:
+                msg = "error removing %s: %s (%s)" % \
+                       (base_dir, exc.strerror, exc.filename)
+            else:
+                msg = "error removing %s: %s" % (base_dir, exc.strerror)
+            self.warn (msg)
 
 
     def make_tarball (self, base_dir, compress="gzip"):