summaryrefslogtreecommitdiff
diff options
authorMichał Górny <mgorny@gentoo.org>2025-07-15 17:03:29 +0200
committerMichał Górny <mgorny@gentoo.org>2025-07-18 06:39:05 +0200
commit640d02f45eab6e8bb866ce6f591d2d18462bbd9a (patch)
tree5e82b7f035fdf92856afa857493dcfdccd5aa3fe /dev-python/ensurepip-pip
parentdev-python/ensurepip-wheel: Streamline vendored dep licenses (diff)
downloadgentoo-640d02f45eab6e8bb866ce6f591d2d18462bbd9a.tar.gz
gentoo-640d02f45eab6e8bb866ce6f591d2d18462bbd9a.tar.bz2
gentoo-640d02f45eab6e8bb866ce6f591d2d18462bbd9a.zip
dev-python/ensurepip-pip: Streamline vendored dep licenses
Signed-off-by: Michał Górny <mgorny@gentoo.org> Part-of: https://github.com/gentoo/gentoo/pull/43014 Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/ensurepip-pip')
-rw-r--r--dev-python/ensurepip-pip/ensurepip-pip-25.1.1-r1.ebuild53
1 files changed, 52 insertions, 1 deletions
diff --git a/dev-python/ensurepip-pip/ensurepip-pip-25.1.1-r1.ebuild b/dev-python/ensurepip-pip/ensurepip-pip-25.1.1-r1.ebuild
index 8d508587edec..bf8abb59726e 100644
--- a/dev-python/ensurepip-pip/ensurepip-pip-25.1.1-r1.ebuild
+++ b/dev-python/ensurepip-pip/ensurepip-pip-25.1.1-r1.ebuild
@@ -22,7 +22,7 @@ SRC_URI="
"
S=${WORKDIR}/${MY_P}
-LICENSE="Apache-2.0 BSD BSD-2 ISC LGPL-2.1+ MIT MPL-2.0 PSF-2"
+LICENSE="MIT"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
IUSE="test test-rust"
@@ -50,6 +50,30 @@ EPYTEST_PLUGINS=( pytest-rerunfailures )
EPYTEST_XDIST=1
distutils_enable_tests pytest
+declare -A VENDOR_LICENSES=(
+ [cachecontrol]=Apache-2.0
+ [certifi]=MPL-2.0
+ [dependency_groups]=MIT
+ [distlib]=PSF-2
+ [distro]=Apache-2.0
+ [idna]=BSD
+ [msgpack]=Apache-2.0
+ [packaging]="|| ( Apache-2.0 MIT )"
+ [pkg_resources]=MIT
+ [platformdirs]=MIT
+ [pygments]=BSD-2
+ [pyproject_hooks]=MIT
+ [requests]=Apache-2.0
+ [resolvelib]=ISC
+ [rich]=MIT
+ [tomli]=MIT
+ [tomli_w]=MIT
+ [truststore]=MIT
+ [urllib3]=MIT
+ [typing_extensions.py]=PSF-2
+)
+LICENSE+=" ${VENDOR_LICENSES[*]}"
+
python_prepare_all() {
local PATCHES=(
"${FILESDIR}/pip-23.1-no-coverage.patch"
@@ -64,6 +88,33 @@ python_prepare_all() {
mkdir tests/data/common_wheels/ || die
cp "${wheels[@]}" tests/data/common_wheels/ || die
fi
+
+ # Verify that we've covered licenses for all vendored packages
+ cd src/pip/_vendor || die
+ local packages=( */ [A-Za-z]*.py )
+ 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_test() {