| from multiprocessing.dummy import Pool |
| ).communicate()[0].decode() |
| # get the info for the package |
| _pkg_info = shell('apt-cache policy ' + pkg) |
| # extract the installed and candidate |
| for line in _pkg_info.splitlines(): |
| if line.find("Installed") > 0: |
| _installed = line.split(':', 1)[1].strip() |
| elif line.find("Candidate") > 0: |
| _candidate = line.split(':', 1)[1].strip() |
| return [pkg, _installed, _candidate, _pkg_info] |
| _list = shell("apt list --installed") |
| pkg_list = _list.splitlines() |
| pkg_list = [_pkg.split('/')[0] for _pkg in pkg_list[1:]] |
| result = pool.map(get_versions, pkg_list) |
| pkgs[_pkg]['installed'] = res[1] |
| pkgs[_pkg]['candidate'] = res[2] |
| pkgs[_pkg]['raw'] = res[3] |