def _process_emerge_err(stdout, stderr):
 ret = {}
 rexp = re.compile('^[<>=][^ ]+/[^ ]+ [^\\n]+', re.M)
 slot_conflicts = re.compile('^[^ \\n]+/[^ ]+:[^ ]', re.M).findall(stderr)
 if slot_conflicts:
  ret['slot conflicts'] = slot_conflicts
 blocked = re.compile('(?m)^\\[blocks .+\\] ([^ ]+/[^ ]+-[0-9]+[^ ]+).*$').findall(stdout)
 unsatisfied = re.compile('Error: The above package list contains').findall(stderr)
 if (blocked and unsatisfied):
  ret['blocked'] = blocked
 sections = re.split('\n\n', stderr)
 for section in sections:
  if ('The following keyword changes' in section):
   ret['keywords'] = rexp.findall(section)
  elif ('The following license changes' in section):
   ret['license'] = rexp.findall(section)
  elif ('The following USE changes' in section):
   ret['use'] = rexp.findall(section)
  elif ('The following mask changes' in section):
   ret['mask'] = rexp.findall(section)
 return ret

def _process_emerge_err ( stdout , stderr ) : ret = { } rexp = re . compile ( '^[<>=][^ ]+/[^ ]+ [^\\n]+' , re . M ) slot_conflicts = re . compile ( '^[^ \\n]+/[^ ]+:[^ ]' , re . M ) . findall ( stderr ) if slot_conflicts : ret [ 'slot conflicts' ] = slot_conflicts blocked = re . compile ( '(?m)^\\[blocks .+\\] ([^ ]+/[^ ]+-[0-9]+[^ ]+).*$' ) . findall ( stdout ) unsatisfied = re . compile ( 'Error: The above package list contains' ) . findall ( stderr ) if ( blocked and unsatisfied ) : ret [ 'blocked' ] = blocked sections = re . split ( '\n\n' , stderr ) for section in sections : if ( 'The following keyword changes' in section ) : ret [ 'keywords' ] = rexp . findall ( section ) elif ( 'The following license changes' in section ) : ret [ 'license' ] = rexp . findall ( section ) elif ( 'The following USE changes' in section ) : ret [ 'use' ] = rexp . findall ( section ) elif ( 'The following mask changes' in section ) : ret [ 'mask' ] = rexp . findall ( section ) return ret
used to parse emerge output to provide meaningful output when emerge fails .