diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-07-19 10:28:09 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-07-19 10:28:09 +0000 |
commit | 371456450e7b3ef9aa455977168bded61db32f91 (patch) | |
tree | c5975a3f1eeaa0ed6ac4d5e5557fecaf5689496c | |
parent | d834a5341dcf3b53408265f75cecc640b6e4fc47 (diff) | |
download | portage-371456450e7b3ef9aa455977168bded61db32f91.tar.gz portage-371456450e7b3ef9aa455977168bded61db32f91.tar.bz2 portage-371456450e7b3ef9aa455977168bded61db32f91.zip |
Fix JobStatusDisplay._init_term() to supply default codes in cases when
curses.tigetstr() returns None.
svn path=/main/trunk/; revision=11136
-rw-r--r-- | pym/_emerge/__init__.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 76a279711..fdc257b30 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -8422,9 +8422,7 @@ class JobStatusDisplay(object): isatty = hasattr(out, "isatty") and out.isatty() object.__setattr__(self, "_isatty", isatty) - if isatty: - self._init_term() - else: + if not isatty or not self._init_term(): term_codes = {} for k, capname in self._termcap_name_map.iteritems(): term_codes[k] = self._default_term_codes[capname] @@ -8433,6 +8431,9 @@ class JobStatusDisplay(object): def _init_term(self): """ Initialize term control codes. + @rtype: bool + @returns: True if term codes were successfully initialized, + False otherwise. """ term_type = os.environ.get("TERM", "vt100") @@ -8449,13 +8450,16 @@ class JobStatusDisplay(object): pass if tigetstr is None: - def tigetstr(capname): - return self._default_term_codes[capname] + return False term_codes = {} for k, capname in self._termcap_name_map.iteritems(): - term_codes[k] = tigetstr(capname) + code = tigetstr(capname) + if code is None: + code = self._default_term_codes[capname] + term_codes[k] = code object.__setattr__(self, "_term_codes", term_codes) + return True def _format_msg(self, msg): return ">>> %s" % msg |