def get_version_updates(versions, blacklist=(), index=None):
    """Checks all packages in current_versions for newer releases and returns
    a new dict with all updated packages, ignoring those listed
    in the blacklist.
    """

    versions = [(pkg, vers) for (pkg, vers) in versions.items()
                if pkg not in blacklist]

    updates = {}
    for package, version in ProgressLogger(versions, sys.stderr):
        newest = get_newest_release(package, index=index)
        if newest is None:
            continue

        if version != newest:
            updates[package] = newest

    return updates
 def test_get_newest_package_vesion_from_pypi_with_custom_index(self):
     index = 'https://pypi.python.org/simple'
     self.assertEquals('0.1', get_newest_release('foobar2', index))
 def test_get_newest_package_vesion_from_pypi(self):
     self.assertEquals('0.1', get_newest_release('foobar2'))
 def test_get_newest_package_vesion_from_pypi_with_custom_index(self):
     index = 'https://pypi.python.org/simple'
     self.assertEquals('0.1', get_newest_release('foobar2', index))
 def test_get_newest_package_vesion_from_pypi(self):
     self.assertEquals('0.1', get_newest_release('foobar2'))