portage.package.ebuild._config.LicenseManager module

class portage.package.ebuild._config.LicenseManager.LicenseManager(license_group_locations, abs_user_config, user_config=True)

Bases: object

_expandLicenseToken(token, traversed_groups)
_getMaskedLicenses(license_struct, acceptable_licenses)
_getPkgAcceptLicense(cpv, slot, repo)

Get an ACCEPT_LICENSE list, accounting for package.license.


Take a token from ACCEPT_LICENSE or package.license and expand it if it’s a group token (indicated by @) or just return it if it’s not a group. If a group is negated then negate all group elements.

getMissingLicenses(cpv, use, lic, slot, repo)

Take a LICENSE string and return a list of any licenses that the user may need to accept for the given package. The returned list will not contain any licenses that have already been accepted. This method can throw an InvalidDependString exception.

  • cpv (String) – The package name (for package.license support)

  • use (String) – “USE” from the cpv’s metadata

  • lic (String) – “LICENSE” from the cpv’s metadata

  • slot (String) – “SLOT” from the cpv’s metadata

Return type



A list of licenses that have not been accepted.

get_prunned_accept_license(cpv, use, lic, slot, repo)

Generate a pruned version of ACCEPT_LICENSE, by intersection with LICENSE. This is required since otherwise ACCEPT_LICENSE might be too big (bigger than ARG_MAX), causing execve() calls to fail with E2BIG errors as in bug #262647.