diff options
author | Greg Ward <gward@python.net> | 1999-12-16 01:14:15 (GMT) |
---|---|---|
committer | Greg Ward <gward@python.net> | 1999-12-16 01:14:15 (GMT) |
commit | ad83f04086bba6484be81a2a734432177b226f39 (patch) | |
tree | b6e95d83306a6828fad06f73108e8dcd8a0bc30f | |
parent | 88f6ca2ce9dd8ec3a2ef11e5b1dc31b4b44e0850 (diff) | |
download | cpython-ad83f04086bba6484be81a2a734432177b226f39.zip cpython-ad83f04086bba6484be81a2a734432177b226f39.tar.gz cpython-ad83f04086bba6484be81a2a734432177b226f39.tar.bz2 |
Catch errors from 'rmtree' and emit a warning.
-rw-r--r-- | Lib/distutils/command/dist.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Lib/distutils/command/dist.py b/Lib/distutils/command/dist.py index 2e4aacd..9931e37 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"): |