]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Changed 'remove_tree()' to use the new 'grok_environment_error()' function
authorGreg Ward <gward@python.net>
Sat, 17 Jun 2000 02:18:19 +0000 (02:18 +0000)
committerGreg Ward <gward@python.net>
Sat, 17 Jun 2000 02:18:19 +0000 (02:18 +0000)
instead of muddling through IOError and OSError exception objects itself.

Lib/distutils/dir_util.py

index e5b24fe475889a307ee02956e37a401fbfeca229..838a870d9bd60e5cce5987e63f5dc6d5cac81577 100644 (file)
@@ -193,9 +193,11 @@ def _build_cmdtuple(path, cmdtuples):
 
 def remove_tree (directory, verbose=0, dry_run=0):
     """Recursively remove an entire directory tree.  Any errors are ignored
-       (apart from being reported to stdout if 'verbose' is true)."""
-
+    (apart from being reported to stdout if 'verbose' is true).
+    """
+    from distutils.util import grok_environment_error
     global PATH_CREATED
+
     if verbose:
         print "removing '%s' (and everything under it)" % directory
     if dry_run:
@@ -210,8 +212,5 @@ def remove_tree (directory, verbose=0, dry_run=0):
                 del PATH_CREATED[cmd[1]]
         except (IOError, OSError), exc:
             if verbose:
-                if exc.filename:
-                    print "error removing %s: %s (%s)" % \
-                       (directory, exc.strerror, exc.filename)
-                else:
-                    print "error removing %s: %s" % (directory, exc.strerror)
+                print grok_environment_error(
+                    exc, "error removing %s: " % directory)