Index: Lib/distutils/core.py =================================================================== --- Lib/distutils/core.py (revision 68571) +++ Lib/distutils/core.py (working copy) @@ -15,7 +15,6 @@ from distutils.debug import DEBUG from distutils.errors import * -from distutils.util import grok_environment_error # Mainly import these so setup scripts can "from distutils.core import" them. from distutils.dist import Distribution @@ -152,8 +151,8 @@ dist.run_commands() except KeyboardInterrupt: raise SystemExit, "interrupted" - except (IOError, os.error), exc: - error = grok_environment_error(exc) + except (IOError, OSError, DistutilsError, CCompilerError), exc: + error = "error: %s" % (exc,) if DEBUG: sys.stderr.write(error + "\n") @@ -161,13 +160,6 @@ else: raise SystemExit, error - except (DistutilsError, - CCompilerError), msg: - if DEBUG: - raise - else: - raise SystemExit, "error: " + str(msg) - return dist # setup () Index: Lib/distutils/util.py =================================================================== --- Lib/distutils/util.py (revision 68571) +++ Lib/distutils/util.py (working copy) @@ -270,29 +270,15 @@ # subst_vars () - +# Kept for compatibility def grok_environment_error (exc, prefix="error: "): """Generate a useful error message from an EnvironmentError (IOError or - OSError) exception object. Handles Python 1.5.1 and 1.5.2 styles, and - does what it can to deal with exception objects that don't have a - filename (which happens when the error is due to a two-file operation, - such as 'rename()' or 'link()'. Returns the error message as a string + OSError) exception object. Returns the error message as a string prefixed with 'prefix'. """ - # check for Python 1.5.2-style {IO,OS}Error exception objects - if hasattr(exc, 'filename') and hasattr(exc, 'strerror'): - if exc.filename: - error = prefix + "%s: %s" % (exc.filename, exc.strerror) - else: - # two-argument functions in posix module don't - # include the filename in the exception object! - error = prefix + "%s" % exc.strerror - else: - error = prefix + str(exc[-1]) + return prefix + str(exc) - return error - # Needed by 'split_quoted()' _wordchars_re = _squote_re = _dquote_re = None def _init_regex(): Index: Lib/distutils/dir_util.py =================================================================== --- Lib/distutils/dir_util.py (revision 68571) +++ Lib/distutils/dir_util.py (working copy) @@ -194,7 +194,6 @@ """Recursively remove an entire directory tree. Any errors are ignored (apart from being reported to stdout if 'verbose' is true). """ - from distutils.util import grok_environment_error global _path_created log.info("removing '%s' (and everything under it)", directory) @@ -210,8 +209,7 @@ if abspath in _path_created: del _path_created[abspath] except (IOError, OSError), exc: - log.warn(grok_environment_error( - exc, "error removing %s: " % directory)) + log.warn("error removing %s: %s" % (directory, exc)) def ensure_relative (path):