commit:     b62e9c2566791ed15e72cf95dbe9b64968da8535
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 15 14:39:18 2025 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Jul 18 04:39:05 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b62e9c25

dev-python/ensurepip-wheel: Streamline vendored dep licenses

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
Part-of: https://github.com/gentoo/gentoo/pull/43014
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../ensurepip-wheel-0.45.1-r1.ebuild               | 36 ++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/dev-python/ensurepip-wheel/ensurepip-wheel-0.45.1-r1.ebuild 
b/dev-python/ensurepip-wheel/ensurepip-wheel-0.45.1-r1.ebuild
index a65e1d9d1d1c..53d7282aedf6 100644
--- a/dev-python/ensurepip-wheel/ensurepip-wheel-0.45.1-r1.ebuild
+++ b/dev-python/ensurepip-wheel/ensurepip-wheel-0.45.1-r1.ebuild
@@ -36,6 +36,42 @@ PATCHES=(
        "${FILESDIR}/wheel-0.45.1-test.patch"
 )
 
+declare -A VENDOR_LICENSES=(
+       [packaging]="|| ( Apache-2.0 MIT )"
+)
+LICENSE+=" ${VENDOR_LICENSES[*]}"
+
+src_prepare() {
+       distutils-r1_src_prepare
+
+       # Verify that we've covered licenses for all vendored packages
+       cd src/wheel/vendored || die
+       local packages=( */ )
+       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
+
+       local upstream_count=$(wc -l < vendor.txt || die)
+       if [[ ${#packages[@]} -ne ${upstream_count} ]]; then
+               eerror "VENDOR_LICENSES: ${#packages[@]}"
+               eerror "vendor.txt:      ${upstream_count}"
+               die "Not all vendored packages matched"
+       fi
+}
+
 python_compile() {
        # If we're testing, install for all implementations.
        # If we're not, just get one wheel built.

Reply via email to