Bug 1473498 - [mozbuild.base] Fix Python 3 incompatibilities in mozconfig error handling, r=glandium

Use of 'BaseException.message` was deprecated in Python 2.6 (and removed in
Python 3). We should rely on the exception's '__str__' instead.

We also need to ensure the mozconfig subprocess' output is text when formatting
it into the message with Py3.

Differential Revision: https://phabricator.services.mozilla.com/D42843

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andrew Halberstadt 2019-08-27 03:05:59 +00:00
Родитель 9ec9b5b7ab
Коммит 8710cf7cfc
1 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -610,7 +610,7 @@ class MozbuildObject(ProcessExecutionMixin):
'Mozilla Build System', msg], ensure_exit_code=False)
except Exception as e:
self.log(logging.WARNING, 'notifier-failed',
{'error': e.message}, 'Notification center failed: {error}')
{'error': e}, 'Notification center failed: {error}')
def _ensure_objdir_exists(self):
if os.path.isdir(self.statedir):
@ -880,7 +880,7 @@ class MachCommandBase(MozbuildObject):
sys.exit(1)
except MozconfigLoadException as e:
print(e.message)
print(e)
sys.exit(1)
MozbuildObject.__init__(self, topsrcdir, context.settings,
@ -895,11 +895,11 @@ class MachCommandBase(MozbuildObject):
self.mozconfig
except MozconfigFindException as e:
print(e.message)
print(e)
sys.exit(1)
except MozconfigLoadException as e:
print(e.message)
print(e)
sys.exit(1)
# Always keep a log of the last command, but don't do that for mach