Esempio n. 1
0
def filter_latest_pkgs(pkgs):
    pkgname2latest = {}

    for x in pkgs:
        pkgname = core.normalize_pkgname(x.pkgname)

        if pkgname not in pkgname2latest:
            pkgname2latest[pkgname] = x
        elif x.parsed_version > pkgname2latest[pkgname].parsed_version:
            pkgname2latest[pkgname] = x

    return pkgname2latest.values()
Esempio n. 2
0
def filter_latest_pkgs(pkgs):
    pkgname2latest = {}

    for x in pkgs:
        pkgname = core.normalize_pkgname(x.pkgname)

        if pkgname not in pkgname2latest:
            pkgname2latest[pkgname] = x
        elif x.parsed_version > pkgname2latest[pkgname].parsed_version:
            pkgname2latest[pkgname] = x

    return pkgname2latest.values()
Esempio n. 3
0
def simpleindex():
    package_groups = defaultdict(list)
    for x in packages():
        if x.pkgname:
            package_groups[normalize_pkgname(x.pkgname)].append(
                (x.pkgname, x.relfn))

    prefixes = []
    for package_group in package_groups.itervalues():
        for pkgname, relfn in package_group:
            if relfn.endswith('.egg'):
                backup_name = pkgname
            else:
                prefixes.append(pkgname)
                break
        else:
            prefixes.append(backup_name)
    prefixes = sorted(prefixes)

    res = ["<html><head><title>Simple Index</title></head><body>\n"]
    for x in prefixes:
        res.append('<a href="%s/">%s</a><br>\n' % (x, x))
    res.append("</body></html>")
    return "".join(res)