Beispiel #1
0
    def installed_version(self):

        if self._version is None:
            try:
                self._version = yolklib.get_highest_installed(self.name)
            except IndexError:
                self._version = INSTALLED_VERSION_NOT_INSTALLED
        return self._version
Beispiel #2
0
    def worker_function(pkg):
        for (dist, active) in yolklib.get_distributions(
                'all', pkg, yolklib.get_highest_installed(pkg)):

            if exception:
                return

            width = terminal_width()
            if width:
                print(u'\rChecking {}'.format(dist.project_name).ljust(width),
                      end='',
                      file=sys.stderr)

            (project_name,
             versions) = pypi.query_versions_pypi(dist.project_name)
        return (pkg, dist, project_name, versions)
Beispiel #3
0
def get_fresh_updates(package_name="", version=""):
    ret = []
    pypi = CheeseShop()
    for pkg in get_pkglist():
        for (dist, active) in get_distributions("all", pkg,
                                                get_highest_installed(pkg)):
            (project_name,
             versions) = pypi.query_versions_pypi(dist.project_name)
            if versions:
                newest = get_highest_version(versions)
                if newest != dist.version:
                    if pkg_resources.parse_version(
                            dist.version) < pkg_resources.parse_version(
                                newest):
                        ret.append([project_name, dist.version, newest])

    return ret
Beispiel #4
0
    def worker_function(pkg):
        for (dist, active) in yolklib.get_distributions(
                'all', pkg,
                yolklib.get_highest_installed(pkg)):

            if exception:
                return

            width = terminal_width()
            if width:
                print('\rChecking {}'.format(dist.project_name).ljust(width),
                      end='',
                      file=sys.stderr)

            (project_name, versions) = pypi.query_versions_pypi(
                dist.project_name)
        return (pkg, dist, project_name, versions)
    def test_latest_vulndb(self):
        pkg = 'vulndb'
        found = None
        pypi = CheeseShop(False)
        all_dists = get_distributions('all', pkg,
                                      get_highest_installed(pkg))

        for dist, active in all_dists:
            project_name, versions = pypi.query_versions_pypi(dist.project_name)

            if versions:
                # PyPI returns them in chronological order,
                # but who knows if its guaranteed in the API?
                # Make sure we grab the highest version:
                newest = get_highest_version(versions)
                if newest != dist.version:

                    # We may have newer than what PyPI knows about
                    if pkg_resources.parse_version(dist.version) < \
                    pkg_resources.parse_version(newest):
                        found = True

        if found:
            self.assertTrue(False, MESSAGE)
    def test_latest_vulndb(self):
        pkg = 'vulndb'
        found = None
        pypi = CheeseShop(False)
        all_dists = get_distributions('all', pkg, get_highest_installed(pkg))

        for dist, active in all_dists:
            project_name, versions = pypi.query_versions_pypi(
                dist.project_name)

            if versions:
                # PyPI returns them in chronological order,
                # but who knows if its guaranteed in the API?
                # Make sure we grab the highest version:
                newest = get_highest_version(versions)
                if newest != dist.version:

                    # We may have newer than what PyPI knows about
                    if pkg_resources.parse_version(dist.version) < \
                    pkg_resources.parse_version(newest):
                        found = True

        if found:
            self.assertTrue(False, MESSAGE)