#!/usr/bin/python from apt import Cache for pkg in Cache(): if pkg.is_upgradable: print "%s: %s" % (pkg.name, pkg.packageSize)