mark.hammond
2008-10-05 09:00:29 UTC
Author: mark.hammond
Date: Sun Oct 5 11:00:28 2008
New Revision: 66806
Log:
Fix [issue4038] py3k error in distutils file_copy exception handlers. r=martin.
Modified:
python/branches/py3k/Lib/distutils/file_util.py
Modified: python/branches/py3k/Lib/distutils/file_util.py
==============================================================================
--- python/branches/py3k/Lib/distutils/file_util.py (original)
+++ python/branches/py3k/Lib/distutils/file_util.py Sun Oct 5 11:00:28 2008
@@ -30,31 +30,27 @@
try:
fsrc = open(src, 'rb')
except os.error as e:
- (errno, errstr) = e
- raise DistutilsFileError("could not open '%s': %s" % (src, errstr))
+ raise DistutilsFileError("could not open '%s': %s" % (src, e.strerror))
if os.path.exists(dst):
try:
os.unlink(dst)
except os.error as e:
- (errno, errstr) = e
raise DistutilsFileError(
- "could not delete '%s': %s" % (dst, errstr))
+ "could not delete '%s': %s" % (dst, e.strerror))
try:
fdst = open(dst, 'wb')
except os.error as e:
- (errno, errstr) = e
raise DistutilsFileError(
- "could not create '%s': %s" % (dst, errstr))
+ "could not create '%s': %s" % (dst, e.strerror))
while True:
try:
buf = fsrc.read(buffer_size)
except os.error as e:
- (errno, errstr) = e
raise DistutilsFileError(
- "could not read from '%s': %s" % (src, errstr))
+ "could not read from '%s': %s" % (src, e.strerror))
if not buf:
break
@@ -62,9 +58,8 @@
try:
fdst.write(buf)
except os.error as e:
- (errno, errstr) = e
raise DistutilsFileError(
- "could not write to '%s': %s" % (dst, errstr))
+ "could not write to '%s': %s" % (dst, e.strerror))
finally:
if fdst:
fdst.close()
Date: Sun Oct 5 11:00:28 2008
New Revision: 66806
Log:
Fix [issue4038] py3k error in distutils file_copy exception handlers. r=martin.
Modified:
python/branches/py3k/Lib/distutils/file_util.py
Modified: python/branches/py3k/Lib/distutils/file_util.py
==============================================================================
--- python/branches/py3k/Lib/distutils/file_util.py (original)
+++ python/branches/py3k/Lib/distutils/file_util.py Sun Oct 5 11:00:28 2008
@@ -30,31 +30,27 @@
try:
fsrc = open(src, 'rb')
except os.error as e:
- (errno, errstr) = e
- raise DistutilsFileError("could not open '%s': %s" % (src, errstr))
+ raise DistutilsFileError("could not open '%s': %s" % (src, e.strerror))
if os.path.exists(dst):
try:
os.unlink(dst)
except os.error as e:
- (errno, errstr) = e
raise DistutilsFileError(
- "could not delete '%s': %s" % (dst, errstr))
+ "could not delete '%s': %s" % (dst, e.strerror))
try:
fdst = open(dst, 'wb')
except os.error as e:
- (errno, errstr) = e
raise DistutilsFileError(
- "could not create '%s': %s" % (dst, errstr))
+ "could not create '%s': %s" % (dst, e.strerror))
while True:
try:
buf = fsrc.read(buffer_size)
except os.error as e:
- (errno, errstr) = e
raise DistutilsFileError(
- "could not read from '%s': %s" % (src, errstr))
+ "could not read from '%s': %s" % (src, e.strerror))
if not buf:
break
@@ -62,9 +58,8 @@
try:
fdst.write(buf)
except os.error as e:
- (errno, errstr) = e
raise DistutilsFileError(
- "could not write to '%s': %s" % (dst, errstr))
+ "could not write to '%s': %s" % (dst, e.strerror))
finally:
if fdst:
fdst.close()