title: python apt_pkg to obtain individual pkg details?
body: <p>I've been using a combination of apt_pkg and apt libraries to obtain the following details from each package:</p>
  
  <pre><code>package.name
  package.installedVersion
  package.description
  package.homepage
  package.priority
  </code></pre>
  
  <p>I was able to obtain what I needed in the following manner, which I'm not entirely sure it's the best method of obtaining the results:</p>
  
  <pre><code>import apt_pkg, apt
  
  apt_pkg.InitConfig()
  apt_pkg.InitSystem()
  
  aptpkg_cache = apt_pkg.GetCache() #Low level 
  apt_cache = apt.Cache() #High level
  
  apt_cache.update()
  apt_cache.open()
  
  pkgs = {}
  list_pkgs = []
  
  for package in aptpkg_cache.Packages:
         try:
            #I use this to pass in the pkg name from the apt_pkg.packages
            #to the high level apt_cache which allows me to obtain the
            #details I need. Is it better to just stick to one library here?
            #In other words, can I obtain this with just apt_pkg instead of using apt?
  
            selected_package = apt_cache[package.name]
  
            #Verify that the package can be upgraded
            if check_pkg_status(package) == "upgradable":
             pkgs["name"] = selected_package.name
                 pkgs["version"] = selected_package.installedVersion
                 pkgs["desc"] = selected_package.description
                 pkgs["homepage"] = selected_package.homepage
                 pkgs["severity"] = selected_package.prority
  
                 list_pkgs.append(pkgs)
            else:
                 print "Package: " + package.name + " does not exist"
                 pass #Not upgradable?
  
          except:
            pass #This is one of the main reasons why I want to try a different method.
                #I'm using this Try/Catch because there are a lot of times that when
                #I pass in package.name to apt_cache[], I get error that package does not
                #exists... 
  
  
  def check_pkg_status(package):
          versions = package.VersionList
          version = versions[0]
          for other_version in versions:
              if apt_pkg.VersionCompare(version.VerStr, other_version.VerStr)&lt;0:
                  version = other_version
  
          if package.CurrentVer:
              current = package.CurrentVer
              if apt_pkg.VersionCompare(current.VerStr, version.VerStr)&lt;0:
                  return "upgradable"
              else:
                  return "current"
          else:
              return "uninstalled"
  </code></pre>
  
  <p>I want to find a good way of using apt_pkg/apt to get the details for each package that's a possible upgrade/update candidate? </p>
  
  <p>The way I'm currently doing this, I only get updates/upgrades for packages already in the system, even though <strong>I noticed the update manager for Debian shows me packages that I don't have in my system.</strong></p>