From fdd25f581023b3a4a98a4682ee20c64fb7567f90 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Thu, 12 May 2016 16:41:15 -0400 Subject: fix error where IOError and OSError exceptions were falling through to the wrong case in Errors.py/convert_to_BuildError().. EnvironmentError is now just an alias in Py3 and it looks like the future module is not properly handling the py3 alias'ing and breaking the py2 exception class hierarchy. --- src/engine/SCons/Errors.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/engine/SCons/Errors.py b/src/engine/SCons/Errors.py index 54e888c..3cc9c6d 100644 --- a/src/engine/SCons/Errors.py +++ b/src/engine/SCons/Errors.py @@ -144,6 +144,7 @@ def convert_to_BuildError(status, exc_info=None): if not exc_info and isinstance(status, Exception): exc_info = (status.__class__, status, None) + if isinstance(status, BuildError): buildError = status buildError.exitstatus = 2 # always exit with 2 on build errors @@ -161,14 +162,17 @@ def convert_to_BuildError(status, exc_info=None): status=2, exitstatus=2, exc_info=exc_info) - elif isinstance(status, EnvironmentError): + elif isinstance(status, (EnvironmentError, OSError, IOError)): # If an IOError/OSError happens, raise a BuildError. # Report the name of the file or directory that caused the # error, which might be different from the target being built # (for example, failure to create the directory in which the # target file will appear). - try: filename = status.filename - except AttributeError: filename = None + try: + filename = status.filename + except AttributeError: + filename = None + buildError = BuildError( errstr=status.strerror, status=status.errno, -- cgit v0.12