summaryrefslogtreecommitdiffstats
path: root/Lib/distutils
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2000-04-22 03:20:49 (GMT)
committerGreg Ward <gward@python.net>2000-04-22 03:20:49 (GMT)
commitd80506c23815aa1410c44dfb65cd53abdd12ffa0 (patch)
tree8df5b76b0c2a67a57fe04937a2da68caa801698d /Lib/distutils
parent6a9a545ab11694411947ae52aad2502e9094c710 (diff)
downloadcpython-d80506c23815aa1410c44dfb65cd53abdd12ffa0.zip
cpython-d80506c23815aa1410c44dfb65cd53abdd12ffa0.tar.gz
cpython-d80506c23815aa1410c44dfb65cd53abdd12ffa0.tar.bz2
Merged in code from the 0.1.5 release to handle IOError and OSError
exceptions better.
Diffstat (limited to 'Lib/distutils')
-rw-r--r--Lib/distutils/core.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/Lib/distutils/core.py b/Lib/distutils/core.py
index 814f441..4b69692 100644
--- a/Lib/distutils/core.py
+++ b/Lib/distutils/core.py
@@ -9,7 +9,7 @@ really defined in distutils.dist and distutils.cmd."""
__revision__ = "$Id$"
-import sys
+import sys, os
from types import *
from distutils.errors import *
from distutils.dist import Distribution
@@ -89,13 +89,19 @@ def setup (**attrs):
dist.run_commands ()
except KeyboardInterrupt:
raise SystemExit, "interrupted"
- except (OSError, IOError), exc:
- # arg, try to work with Python pre-1.5.2
+ except (IOError, os.error), exc:
+ # check for Python 1.5.2-style {IO,OS}Error exception objects
if hasattr (exc, 'filename') and hasattr (exc, 'strerror'):
- raise SystemExit, \
- "error: %s: %s" % (exc.filename, exc.strerror)
+ if exc.filename:
+ raise SystemExit, \
+ "error: %s: %s" % (exc.filename, exc.strerror)
+ else:
+ # two-argument functions in posix module don't
+ # include the filename in the exception object!
+ raise SystemExit, \
+ "error: %s" % exc.strerror
else:
- raise SystemExit, str (exc)
+ raise SystemExit, "error: " + exc[-1]
except (DistutilsExecError,
DistutilsFileError,
DistutilsOptionError), msg: