Avoid “error: None” messages from distutils (#4931).

Thanks to Amaury Forgeot d’Arc and Philip J. Eby.
This commit is contained in:
Éric Araujo 2014-03-12 03:34:02 -04:00
parent ed5d95b76b
commit fc773a2d4b
6 changed files with 20 additions and 38 deletions

View file

@ -2,7 +2,7 @@
Utility functions for manipulating directories and directory trees."""
import os, sys
import os
import errno
from distutils.errors import DistutilsFileError, DistutilsInternalError
from distutils import log
@ -182,7 +182,6 @@ def remove_tree(directory, verbose=1, dry_run=0):
Any errors are ignored (apart from being reported to stdout if 'verbose'
is true).
"""
from distutils.util import grok_environment_error
global _path_created
if verbose >= 1:
@ -199,8 +198,7 @@ def remove_tree(directory, verbose=1, dry_run=0):
if abspath in _path_created:
del _path_created[abspath]
except (IOError, OSError) as exc:
log.warn(grok_environment_error(
exc, "error removing %s: " % directory))
log.warn("error removing %s: %s", directory, exc)
def ensure_relative(path):
"""Take the full path 'path', and make it a relative path.