Exemplo n.º 1
0
def create_depends_string(suite, depends_tree, session=None):
    result = ""
    if suite == 'experimental':
        suite_list = ['experimental', 'unstable']
    else:
        suite_list = [suite]

    provides = set()
    comma_count = 1
    for l in depends_tree:
        if (comma_count >= 2):
            result += ", "
        or_count = 1
        for d in l:
            if (or_count >= 2):
                result += " | "
            # doesn't do version lookup yet.

            component = get_component_by_package_suite(d['name'],
                                                       suite_list,
                                                       session=session)
            if component is not None:
                adepends = d['name']
                if d['version'] != '':
                    adepends += " (%s)" % (d['version'])

                if component == "contrib":
                    result += colour_output(adepends, "contrib")
                elif component == "non-free":
                    result += colour_output(adepends, "nonfree")
                else:
                    result += colour_output(adepends, "main")
            else:
                adepends = d['name']
                if d['version'] != '':
                    adepends += " (%s)" % (d['version'])
                if not provides:
                    provides = get_provides(suite)
                if d['name'] in provides:
                    result += colour_output(adepends, "provides")
                else:
                    result += colour_output(adepends, "bold")
            or_count += 1
        comma_count += 1
    return result
Exemplo n.º 2
0
def create_depends_string (suite, depends_tree, session = None):
    result = ""
    if suite == 'experimental':
        suite_list = ['experimental','unstable']
    else:
        suite_list = [suite]

    provides = set()
    comma_count = 1
    for l in depends_tree:
        if (comma_count >= 2):
            result += ", "
        or_count = 1
        for d in l:
            if (or_count >= 2 ):
                result += " | "
            # doesn't do version lookup yet.

            component = get_component_by_package_suite(d['name'], suite_list, \
                session = session)
            if component is not None:
                adepends = d['name']
                if d['version'] != '' :
                    adepends += " (%s)" % (d['version'])

                if component == "contrib":
                    result += colour_output(adepends, "contrib")
                elif component == "non-free":
                    result += colour_output(adepends, "nonfree")
                else :
                    result += colour_output(adepends, "main")
            else:
                adepends = d['name']
                if d['version'] != '' :
                    adepends += " (%s)" % (d['version'])
                if not provides:
                    provides = get_provides(suite)
                if d['name'] in provides:
                    result += colour_output(adepends, "provides")
                else:
                    result += colour_output(adepends, "bold")
            or_count += 1
        comma_count += 1
    return result