Bug 1493345 Fix improper usage of blessings.tigetstr r=ted,firefox-build-system-reviewers
authorJay Kamat <jaygkamat@gmail.com>
Tue, 02 Oct 2018 18:36:30 +0000
changeset 494948 f69ecb2abf86e239c528a27f394e88019bd7cdae
parent 494947 8b650bb26b719660566eef5493a920a481027b12
child 494949 193cb0e601503e08540a5c52a723bfb088e0e2e3
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted, firefox-build-system-reviewers
bugs1493345
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1493345 Fix improper usage of blessings.tigetstr r=ted,firefox-build-system-reviewers blessings.tigetstr is not part of its API. It happens to work because blessings imports curses using 'from curses import tigetstr'. Instead, we can just use terminal.normal, which contains the string we were going to get anyway. See https://github.com/erikrose/blessings/pull/138 for more information. Let me know if there's a better way of resolving this. Hopefully with this + the patch I submitted to blessings (https://github.com/erikrose/blessings/pull/137) firefox will build fine with TERM improperly set. Differential Revision: https://phabricator.services.mozilla.com/D5377
python/mach/mach/logging.py
--- a/python/mach/mach/logging.py
+++ b/python/mach/mach/logging.py
@@ -88,17 +88,17 @@ class StructuredHumanFormatter(logging.F
         return t
 
 
 class StructuredTerminalFormatter(StructuredHumanFormatter):
     """Log formatter for structured messages writing to a terminal."""
 
     def set_terminal(self, terminal):
         self.terminal = terminal
-        self._sgr0 = blessings.tigetstr('sgr0') or '' if terminal and blessings else ''
+        self._sgr0 = terminal.normal if terminal and blessings else ''
 
     def format(self, record):
         f = record.msg.format(**record.params)
 
         if not self.write_times:
             return f
 
         t = self.terminal.blue(format_seconds(self._time(record)))