From 8710cf7cfcbab28857a7fea01de85599d84cc0ea Mon Sep 17 00:00:00 2001 From: Andrew Halberstadt Date: Tue, 27 Aug 2019 03:05:59 +0000 Subject: [PATCH] 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 --- python/mozbuild/mozbuild/base.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python/mozbuild/mozbuild/base.py b/python/mozbuild/mozbuild/base.py index 6c798a0ea93f..a380f908597c 100644 --- a/python/mozbuild/mozbuild/base.py +++ b/python/mozbuild/mozbuild/base.py @@ -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