def _parse_apt(self, d): r = [] for l in d.split('\n'): s = filter(None, l.split(' ')) if len(s) == 0: continue p = PackageInfo() if s[0] == 'Inst': p.action = 'i' elif s[0] in ['Remv', 'Purg']: p.action = 'r' else: continue p.name = s[1] p.version = s[2].strip('[]') r.append(p) return r
def _parse_upgradeable(self, d): r = [] for l in d.split('\n'): s = l.split(' ') if len(s) == 1: continue p = PackageInfo() p.action = 'i' p.name = s[0] p.version = s[1] r.append(p) return r