def _eerror(self, lines):
		out = StringIO()
		phase = self.phase
		for line in lines:
			eerror(line, phase=phase, key=self.settings.mycpv, out=out)
		msg = _unicode_decode(out.getvalue(),
			encoding=_encodings['content'], errors='replace')
		if msg:
			self.scheduler.output(msg,
				log_path=self.settings.get("PORTAGE_LOG_FILE"))
Пример #2
0
 def _eerror(self, lines):
     out = StringIO()
     phase = self.phase
     for line in lines:
         eerror(line, phase=phase, key=self.settings.mycpv, out=out)
     msg = _unicode_decode(out.getvalue(),
                           encoding=_encodings['content'],
                           errors='replace')
     if msg:
         self.scheduler.output(
             msg, log_path=self.settings.get("PORTAGE_LOG_FILE"))
Пример #3
0
	def sourcehook(self, newfile):
		try:
			return shlex.shlex.sourcehook(self, newfile)
		except EnvironmentError as e:
			writemsg(_("!!! Parse error in '%s': source command failed: %s\n") % \
				(self.infile, str(e)), noiselevel=-1)
			return (newfile, StringIO())
Пример #4
0
    def _display_status(self):
        # Don't use len(self._completed_tasks) here since that also
        # can include uninstall tasks.
        curval_str = str(self.curval)
        maxval_str = str(self.maxval)
        running_str = str(self.running)
        failed_str = str(self.failed)
        load_avg_str = self._load_avg_str()

        color_output = StringIO()
        plain_output = StringIO()
        style_file = portage.output.ConsoleStyleFile(color_output)
        style_file.write_listener = plain_output
        style_writer = portage.output.StyleWriter(file=style_file, maxcol=9999)
        style_writer.style_listener = style_file.new_styles
        f = formatter.AbstractFormatter(style_writer)

        number_style = "INFORM"
        f.add_literal_data(_unicode_decode("Jobs: "))
        f.push_style(number_style)
        f.add_literal_data(_unicode_decode(curval_str))
        f.pop_style()
        f.add_literal_data(_unicode_decode(" of "))
        f.push_style(number_style)
        f.add_literal_data(_unicode_decode(maxval_str))
        f.pop_style()
        f.add_literal_data(_unicode_decode(" complete"))

        if self.running:
            f.add_literal_data(_unicode_decode(", "))
            f.push_style(number_style)
            f.add_literal_data(_unicode_decode(running_str))
            f.pop_style()
            f.add_literal_data(_unicode_decode(" running"))

        if self.failed:
            f.add_literal_data(_unicode_decode(", "))
            f.push_style(number_style)
            f.add_literal_data(_unicode_decode(failed_str))
            f.pop_style()
            f.add_literal_data(_unicode_decode(" failed"))

        padding = self._jobs_column_width - len(plain_output.getvalue())
        if padding > 0:
            f.add_literal_data(padding * _unicode_decode(" "))

        f.add_literal_data(_unicode_decode("Load avg: "))
        f.add_literal_data(_unicode_decode(load_avg_str))

        # Truncate to fit width, to avoid making the terminal scroll if the
        # line overflows (happens when the load average is large).
        plain_output = plain_output.getvalue()
        if self._isatty and len(plain_output) > self.width:
            # Use plain_output here since it's easier to truncate
            # properly than the color output which contains console
            # color codes.
            self._update(plain_output[:self.width])
        else:
            self._update(color_output.getvalue())

        if self.xterm_titles:
            xtermTitle(" ".join(plain_output.split()))
Пример #5
0
	def _display_status(self):
		# Don't use len(self._completed_tasks) here since that also
		# can include uninstall tasks.
		curval_str = str(self.curval)
		maxval_str = str(self.maxval)
		running_str = str(self.running)
		failed_str = str(self.failed)
		load_avg_str = self._load_avg_str()

		color_output = StringIO()
		plain_output = StringIO()
		style_file = portage.output.ConsoleStyleFile(color_output)
		style_file.write_listener = plain_output
		style_writer = portage.output.StyleWriter(file=style_file, maxcol=9999)
		style_writer.style_listener = style_file.new_styles
		f = formatter.AbstractFormatter(style_writer)

		number_style = "INFORM"
		f.add_literal_data(_unicode_decode("Jobs: "))
		f.push_style(number_style)
		f.add_literal_data(_unicode_decode(curval_str))
		f.pop_style()
		f.add_literal_data(_unicode_decode(" of "))
		f.push_style(number_style)
		f.add_literal_data(_unicode_decode(maxval_str))
		f.pop_style()
		f.add_literal_data(_unicode_decode(" complete"))

		if self.running:
			f.add_literal_data(_unicode_decode(", "))
			f.push_style(number_style)
			f.add_literal_data(_unicode_decode(running_str))
			f.pop_style()
			f.add_literal_data(_unicode_decode(" running"))

		if self.failed:
			f.add_literal_data(_unicode_decode(", "))
			f.push_style(number_style)
			f.add_literal_data(_unicode_decode(failed_str))
			f.pop_style()
			f.add_literal_data(_unicode_decode(" failed"))

		padding = self._jobs_column_width - len(plain_output.getvalue())
		if padding > 0:
			f.add_literal_data(padding * _unicode_decode(" "))

		f.add_literal_data(_unicode_decode("Load avg: "))
		f.add_literal_data(_unicode_decode(load_avg_str))

		# Truncate to fit width, to avoid making the terminal scroll if the
		# line overflows (happens when the load average is large).
		plain_output = plain_output.getvalue()
		if self._isatty and len(plain_output) > self.width:
			# Use plain_output here since it's easier to truncate
			# properly than the color output which contains console
			# color codes.
			self._update(plain_output[:self.width])
		else:
			self._update(color_output.getvalue())

		if self.xterm_titles:
			xtermTitle(" ".join(plain_output.split()))