Package portage :: Module output
[hide private]

Module output

source code

Classes [hide private]
  ConsoleStyleFile
A file-like object that behaves something like the colorize() function.
  StyleWriter
This is just a DumbWriter with a hook in the new_styles() method that passes a styles tuple as a single argument to a callable style_listener attribute.
  EOutput
Performs fancy terminal formatting for status and informational messages.
  ProgressBar
The interface is copied from the ProgressBar class from the EasyDialogs module (which is Mac only).
  TermProgressBar
A tty progress bar similar to wget's.
Functions [hide private]
 
color(fg, bg='default', attr=['normal']) source code
dict
parse_color_map(onerror=None)
Parse /etc/portage/color.map and return a dict of error codes.
source code
 
nc_len(mystr) source code
 
xtermTitle(mystr, raw=False) source code
 
xtermTitleReset() source code
 
notitles()
turn off title setting
source code
 
nocolor()
turn off colorization
source code
 
resetColor() source code
 
colorize(color_key, text) source code
 
create_color_func(color_key) source code
 
get_term_size()
Get the number of lines and columns of the tty that is connected to stdout.
source code
 
set_term_size(lines, columns, fd)
Set the number of lines and columns for the tty that is connected to fd.
source code
 
blue(*args) source code
 
bold(*args) source code
 
brown(*args) source code
 
darkblue(*args) source code
 
darkgreen(*args) source code
 
darkred(*args) source code
 
darkteal(*args) source code
 
darkyellow(*args) source code
 
fuchsia(*args) source code
 
green(*args) source code
 
purple(*args) source code
 
red(*args) source code
 
teal(*args) source code
 
turquoise(*args) source code
 
white(*args) source code
 
yellow(*args) source code
Variables [hide private]
  havecolor = 1
  dotitles = 1
  esc_seq = '\x1b['
  g_attr = {'bg_black': 40, 'bg_blue': 44, 'bg_cyan': 46, 'bg_de...
  codes = {'0x000000': '\x1b[30m', '0x0000AA': '\x1b[34m', '0x00...
  ansi_color_codes = ['30m', '30;01m', '31m', '31;01m', '32m', '...
  rgb_ansi_colors = ['0x000000', '0x555555', '0xAA0000', '0xFF55...
  default_xterm_title = None
  compat_functions_colors = ['bold', 'white', 'teal', 'turquoise...
  c = 'darkred'

Imports: commands, errno, formatter, os, re, shlex, sys, COLOR_MAP_FILE, writemsg, CommandNotFound, FileNotFound, ParseError, PermissionDenied, PortageException


Function Details [hide private]

parse_color_map(onerror=None)

source code 

Parse /etc/portage/color.map and return a dict of error codes.

Parameters:
  • onerror (callable) - an optional callback to handle any ParseError that would otherwise be raised
Returns: dict
a dictionary mapping color classes to color codes

get_term_size()

source code 

Get the number of lines and columns of the tty that is connected to stdout. Returns a tuple of (lines, columns) or (-1, -1) if an error occurs. The curses module is used if available, otherwise the output of `stty size` is parsed.

set_term_size(lines, columns, fd)

source code 

Set the number of lines and columns for the tty that is connected to fd. For portability, this simply calls `stty rows $lines columns $columns`.


Variables Details [hide private]

g_attr

Value:
{'bg_black': 40,
 'bg_blue': 44,
 'bg_cyan': 46,
 'bg_default': 49,
 'bg_green': 42,
 'bg_magenta': 45,
 'bg_red': 41,
 'bg_white': 47,
...

codes

Value:
{'0x000000': '\x1b[30m',
 '0x0000AA': '\x1b[34m',
 '0x00AA00': '\x1b[32m',
 '0x00AAAA': '\x1b[36m',
 '0x555555': '\x1b[30;01m',
 '0x5555FF': '\x1b[34;01m',
 '0x55FF55': '\x1b[32;01m',
 '0x55FFFF': '\x1b[36;01m',
...

ansi_color_codes

Value:
['30m',
 '30;01m',
 '31m',
 '31;01m',
 '32m',
 '32;01m',
 '33m',
 '33;01m',
...

rgb_ansi_colors

Value:
['0x000000',
 '0x555555',
 '0xAA0000',
 '0xFF5555',
 '0x00AA00',
 '0x55FF55',
 '0xAA5500',
 '0xFFFF55',
...

compat_functions_colors

Value:
['bold',
 'white',
 'teal',
 'turquoise',
 'darkteal',
 'fuchsia',
 'purple',
 'blue',
...