[Python-checkins] distutils2: Refactoring -- Removing grok_environment_error.
tarek.ziade
python-checkins at python.org
Wed Feb 16 22:23:56 CET 2011
tarek.ziade pushed 2ca60fd8c79b to distutils2:
http://hg.python.org/distutils2/rev/2ca60fd8c79b
changeset: 1019:2ca60fd8c79b
parent: 1017:b201575c7cdc
user: Kelsey Hightower <kelsey.hightower at gmail.com>
date: Thu Feb 10 21:37:08 2011 -0500
summary:
Refactoring -- Removing grok_environment_error.
files:
distutils2/run.py
distutils2/util.py
docs/source/distutils/apiref.rst
diff --git a/distutils2/run.py b/distutils2/run.py
--- a/distutils2/run.py
+++ b/distutils2/run.py
@@ -4,7 +4,6 @@
import logging
from distutils2 import logger
-from distutils2.util import grok_environment_error
from distutils2.errors import (DistutilsSetupError, DistutilsArgError,
DistutilsError, CCompilerError)
from distutils2.dist import Distribution
@@ -106,12 +105,7 @@
dist.run_commands()
except KeyboardInterrupt:
raise SystemExit("interrupted")
- except (IOError, os.error), exc:
- error = grok_environment_error(exc)
- raise SystemExit(error)
-
- except (DistutilsError,
- CCompilerError), msg:
+ except (IOError, os.error, DistutilsError, CCompilerError), msg:
raise SystemExit("error: " + str(msg))
return dist
diff --git a/distutils2/util.py b/distutils2/util.py
--- a/distutils2/util.py
+++ b/distutils2/util.py
@@ -177,29 +177,6 @@
raise ValueError("invalid variable '$%s'" % var)
-def grok_environment_error(exc, prefix="error: "):
- """Generate a useful error message from an EnvironmentError.
-
- This will generate an IOError or an 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
- 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 error
-
# Needed by 'split_quoted()'
_wordchars_re = _squote_re = _dquote_re = None
diff --git a/docs/source/distutils/apiref.rst b/docs/source/distutils/apiref.rst
--- a/docs/source/distutils/apiref.rst
+++ b/docs/source/distutils/apiref.rst
@@ -1166,15 +1166,6 @@
an underscore. No { } or ( ) style quoting is available.
-.. function:: grok_environment_error(exc[, prefix='error: '])
-
- Generate a useful error message from an :exc:`EnvironmentError`
- (:exc:`IOError` or :exc:`OSError`) exception object. 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 :func:`rename` or
- :func:`link`). Returns the error message as a string prefixed with *prefix*.
-
-
.. function:: split_quoted(s)
Split a string up according to Unix shell-like rules for quotes and
--
Repository URL: http://hg.python.org/distutils2
More information about the Python-checkins
mailing list