import re
import sys
+from portage import _unicode_decode
+
implicit_pattern = re.compile("([^:]*):(\d+): warning: implicit declaration "
+ "of function [`']([^']*)'")
pointer_pattern = re.compile(
last_implicit_func = ""
while True:
- line = sys.stdin.readline()
+ if sys.hexversion >= 0x3000000:
+ line = _unicode_decode(sys.stdin.buffer.readline())
+ else:
+ line = sys.stdin.readline()
if line == '':
break
# translate unicode open/close quotes to ascii ones
if not opts.color == 'y' and \
(opts.color == 'n' or \
portage.settings.get('NOCOLOR') in ('yes', 'true') or \
+ portage.settings.get('TERM') == 'dumb' or \
not sys.stdout.isatty()):
portage.output.nocolor()
portage.settings.unlock()
status = "Attempting to fix %s"
func = "fix"
- isatty = sys.stdout.isatty()
+ isatty = os.environ.get('TERM') != 'dumb' and sys.stdout.isatty()
for task in tasks:
print(status % task.name())
inst = task()
repoman_settings.lock()
if repoman_settings.get("NOCOLOR", "").lower() in ("yes", "true") or \
+ repoman_settings.get('TERM') == 'dumb' or \
not sys.stdout.isatty():
nocolor()
object.__setattr__(self, "_jobs_column_width", width - 32)
self.reset()
- isatty = hasattr(self.out, "isatty") and self.out.isatty()
+ isatty = os.environ.get('TERM') != 'dumb' and \
+ hasattr(self.out, 'isatty') and \
+ self.out.isatty()
object.__setattr__(self, "_isatty", isatty)
if not isatty or not self._init_term():
term_codes = {}
porttrees = [tree_data.path for tree_data in porttrees_data]
- isatty = sys.stdout.isatty()
- quiet = not isatty or '--quiet' in myopts
+ quiet = settings.get('TERM') == 'dumb' or \
+ '--quiet' in myopts or \
+ not sys.stdout.isatty()
+
onProgress = None
if not quiet:
progressBar = portage.output.TermProgressBar()
portage.output.havecolor = 0
settings["NOCOLOR"] = "true"
settings.backup_changes("NOCOLOR")
- elif not sys.stdout.isatty() and settings.get("NOCOLOR") != "no":
+ elif settings.get('TERM') == 'dumb' or \
+ not sys.stdout.isatty():
portage.output.havecolor = 0
settings["NOCOLOR"] = "true"
settings.backup_changes("NOCOLOR")
portage.debug.set_trace(True)
if not ("--quiet" in myopts):
- if not sys.stdout.isatty() or ("--nospinner" in myopts):
+ if '--nospinner' in myopts or \
+ settings.get('TERM') == 'dumb' or \
+ not sys.stdout.isatty():
spinner.update = spinner.update_basic
if myaction == 'version':
self.out.flush()
cache_stats = CacheStats(out)
- have_tty = out.isatty()
+ have_tty = os.environ.get('TERM') != 'dumb' and out.isatty()
if have_tty:
cache_stats.display()
binpkg_filenames = set()
if prompt_command == "":
default_xterm_title = ""
elif prompt_command is not None:
- if dotitles and "TERM" in os.environ and sys.stderr.isatty():
+ if dotitles and \
+ 'TERM' in os.environ and \
+ _legal_terms_re.match(os.environ['TERM']) is not None and \
+ sys.stderr.isatty():
from portage.process import find_binary, spawn
shell = os.environ.get("SHELL")
if not shell or not os.access(shell, os.EX_OK):