From ad83f04086bba6484be81a2a734432177b226f39 Mon Sep 17 00:00:00 2001 From: Greg Ward Date: Thu, 16 Dec 1999 01:14:15 +0000 Subject: [PATCH] Catch errors from 'rmtree' and emit a warning. --- Lib/distutils/command/dist.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Lib/distutils/command/dist.py b/Lib/distutils/command/dist.py index 2e4aacddfc..9931e3752d 100644 --- a/Lib/distutils/command/dist.py +++ b/Lib/distutils/command/dist.py @@ -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"): -- 2.40.0