]> git.draconx.ca Git - gentoo-fixes.git/blob - www-client/firefox/files/firefox-52.9.0-blessings-TERM.patch
app-emulation/wine-vanilla-4.0.4: Adapt mpg123 dependency.
[gentoo-fixes.git] / www-client / firefox / files / firefox-52.9.0-blessings-TERM.patch
1 https://github.com/erikrose/blessings/pull/137
2
3 Fixes: https://bugs.gentoo.org/654316
4
5 From 5fefc65c306cf9ec492e7b422d6bb4842385afbc Mon Sep 17 00:00:00 2001
6 From: Jay Kamat <jaygkamat@gmail.com>
7 Date: Fri, 24 Aug 2018 11:11:57 -0700
8 Subject: [PATCH 1/2] Fix error when TERM is unset or improperly set
9
10 ---
11  blessings/__init__.py | 9 +++++++--
12  1 file changed, 7 insertions(+), 2 deletions(-)
13
14 diff --git a/blessings/__init__.py b/blessings/__init__.py
15 index 98b75c3..3872b5f 100644
16 --- a/python/blessings/blessings/__init__.py
17 +++ b/python/blessings/blessings/__init__.py
18 @@ -94,8 +94,13 @@ def __init__(self, kind=None, stream=None, force_styling=False):
19              # init sequences to the stream if it has a file descriptor, and
20              # send them to stdout as a fallback, since they have to go
21              # somewhere.
22 -            setupterm(kind or environ.get('TERM', 'unknown'),
23 -                      self._init_descriptor)
24 +            try:
25 +                setupterm(kind or environ.get('TERM', 'dumb') or 'dumb',
26 +                          self._init_descriptor)
27 +            except:
28 +                # There was an error setting up the terminal, either curses is
29 +                # not supported or TERM is incorrectly set. Fall back to dumb.
30 +                self._does_styling = False
31  
32          self.stream = stream
33  
34
35 From d885df78c6f931abf3259343aaaa897e16c8cba1 Mon Sep 17 00:00:00 2001
36 From: Jay Kamat <jaygkamat@gmail.com>
37 Date: Sat, 1 Sep 2018 13:20:32 -0700
38 Subject: [PATCH 2/2] Explicitly catch curses.error
39
40 ---
41  blessings/__init__.py | 2 +-
42  1 file changed, 1 insertion(+), 1 deletion(-)
43
44 diff --git a/blessings/__init__.py b/blessings/__init__.py
45 index 3872b5f..fdceb09 100644
46 --- a/python/blessings/blessings/__init__.py
47 +++ b/python/blessings/blessings/__init__.py
48 @@ -97,7 +97,7 @@ def __init__(self, kind=None, stream=None, force_styling=False):
49              try:
50                  setupterm(kind or environ.get('TERM', 'dumb'),
51                            self._init_descriptor)
52 -            except:
53 +            except curses.error:
54                  # There was an error setting up the terminal, either curses is
55                  # not supported or TERM is incorrectly set. Fall back to dumb.
56                  self._does_styling = False