diff options
author | Greg Ward <gward@python.net> | 2000-06-17 02:18:19 (GMT) |
---|---|---|
committer | Greg Ward <gward@python.net> | 2000-06-17 02:18:19 (GMT) |
commit | fcd4f87397039c65c7098f0a6c86961728fb9218 (patch) | |
tree | 59a3c13c882540c2112f5d480e0ec185c5e08c49 /Lib | |
parent | cf0e2dde6def31714accc13bf77c48af281140eb (diff) | |
download | cpython-fcd4f87397039c65c7098f0a6c86961728fb9218.zip cpython-fcd4f87397039c65c7098f0a6c86961728fb9218.tar.gz cpython-fcd4f87397039c65c7098f0a6c86961728fb9218.tar.bz2 |
Changed 'remove_tree()' to use the new 'grok_environment_error()' function
instead of muddling through IOError and OSError exception objects itself.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/distutils/dir_util.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/Lib/distutils/dir_util.py b/Lib/distutils/dir_util.py index e5b24fe..838a870 100644 --- a/Lib/distutils/dir_util.py +++ b/Lib/distutils/dir_util.py @@ -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) |