Пример #1
def get_license_clashes_in_role(builder, role):
    """Find license clashes in the install/ directory of 'role'.

    Returns two dictionaries (binary_items, private_items)

    'binary_items' is a dictionary of {checkout_label : binary_license}

    'private_items' is a dictionary of {checkout_label : private_license}

    If private_items has content, then there is a licensing clash in the given
    role, as one cannot do a binary distribution of both "binary" and "private"
    licensed content in the same "install" directory.
    binary_items = {}
    private_items = {}

    get_checkout_license = builder.db.get_checkout_license

    lbl = Label(LabelType.Package, "*", role, "*", domain="*")
    all_rules = builder.ruleset.rules_for_target(lbl)

    for rule in all_rules:
        pkg_label = rule.target
        checkouts = builder.checkouts_for_package(pkg_label)
        for co_label in checkouts:
            license = get_checkout_license(co_label, absent_is_None=True)
            if license:
                if license.is_binary():
                    binary_items[normalise_checkout_label(co_label)] = license
                elif license.is_private():
                    private_items[normalise_checkout_label(co_label)] = license

    return binary_items, private_items
Пример #2
def get_not_licensed_checkouts(builder):
    """Return the set of all checkouts which do not have a license.

    (Actually, a set of checkout labels, with the label tag "/checked_out").
    all_checkouts = builder.all_checkout_labels()
    result = set()
    checkout_has_license = builder.db.checkout_has_license
    for co_label in all_checkouts:
        if not checkout_has_license(co_label):
    return result