From 54766f55ba4e3e317515dabc440f4af0e78f84c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Tue, 15 Jul 2025 17:13:31 +0200 Subject: [PATCH] dev-python/ensurepip-setuptools: Streamline vendored dep licenses MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny Part-of: https://github.com/gentoo/gentoo/pull/43014 Closes: https://github.com/gentoo/gentoo/pull/43014 Signed-off-by: Michał Górny --- .../ensurepip-setuptools-80.9.0-r1.ebuild | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/dev-python/ensurepip-setuptools/ensurepip-setuptools-80.9.0-r1.ebuild b/dev-python/ensurepip-setuptools/ensurepip-setuptools-80.9.0-r1.ebuild index 16193240eb0e1..525cda9611b65 100644 --- a/dev-python/ensurepip-setuptools/ensurepip-setuptools-80.9.0-r1.ebuild +++ b/dev-python/ensurepip-setuptools/ensurepip-setuptools-80.9.0-r1.ebuild @@ -43,6 +43,50 @@ EPYTEST_PLUGINS=( pytest-{home,subprocess,timeout} ) EPYTEST_XDIST=1 distutils_enable_tests pytest +declare -A VENDOR_LICENSES=( + [autocommand]=LGPL-3 + [backports.tarfile]=MIT + [importlib_metadata]=Apache-2.0 + [inflect]=MIT + [jaraco.collections]=MIT + [jaraco.context]=MIT + [jaraco.functools]=MIT + [jaraco.text]=MIT + [more_itertools]=MIT + [packaging]="|| ( Apache-2.0 MIT )" + [platformdirs]=MIT + [tomli]=MIT + [typeguard]=MIT + [typing_extensions]=PSF-2 + [wheel]=MIT # technically it also vendors packaging but we have that + [zipp]=MIT +) +LICENSE+=" ${VENDOR_LICENSES[*]}" + +src_prepare() { + distutils-r1_src_prepare + + # Verify that we've covered licenses for all vendored packages + cd setuptools/_vendor || die + local packages=( *.dist-info ) + local pkg missing=() + for pkg in "${packages[@]%%-*}"; do + if [[ ! -v "VENDOR_LICENSES[${pkg}]" ]]; then + missing+=( "${pkg}" ) + else + unset "VENDOR_LICENSES[${pkg}]" + fi + done + + if [[ ${missing[@]} || ${VENDOR_LICENSES[@]} ]]; then + [[ ${missing[@]} ]] && + eerror "License missing for packages: ${missing[*]}" + [[ ${VENDOR_LICENSES[@]} ]] && + eerror "Vendored packages removed: ${!VENDOR_LICENSES[*]}" + die "VENDOR_LICENSES outdated" + fi +} + python_compile() { # If we're testing, install for all implementations. # If we're not, just get one wheel built.