eclass/python-utils-r1: Sync with Gentoo

It's from Gentoo commit bafc7b5a1fc937b08a67be7c628f225674a3303d.
This commit is contained in:
Flatcar Buildbot 2023-08-14 07:11:38 +00:00
parent c201765ebf
commit dc15a4da63

View File

@ -338,7 +338,9 @@ _python_export() {
debug-print "${FUNCNAME}: EPYTHON = ${EPYTHON}"
;;
PYTHON)
export PYTHON=${BROOT}/usr/bin/${impl}
# Under EAPI 7+, this should just use ${BROOT}, but Portage
# <3.0.50 was buggy, and prefix users need this to update.
export PYTHON=${BROOT-${EPREFIX}}/usr/bin/${impl}
debug-print "${FUNCNAME}: PYTHON = ${PYTHON}"
;;
PYTHON_SITEDIR)
@ -1244,14 +1246,13 @@ _python_check_occluded_packages() {
# positives before filing bugs.
[[ ! ${PYTHON_EXPERIMENTAL_QA} ]] && return
type -P diff &>/dev/null || return
[[ -z ${BUILD_DIR} || ! -d ${BUILD_DIR}/install ]] && return
local sitedir="${BUILD_DIR}/install$(python_get_sitedir)"
# avoid unnecessarily checking if we are inside install dir
[[ ${sitedir} -ef . ]] && return
local f fn diff
local f fn diff l
for f in "${sitedir}"/*/; do
f=${f%/}
fn=${f##*/}
@ -1260,17 +1261,29 @@ _python_check_occluded_packages() {
[[ ${fn} == *.dist-info || ${fn} == *.egg-info ]] && continue
if [[ -d ${fn} ]]; then
diff=$(diff -dupr -x "__pycache__" "${fn}" "${sitedir}/${fn}")
diff=$(
comm -1 -3 <(
find "${fn}" -type f -not -path '*/__pycache__/*' |
sort
assert
) <(
cd "${sitedir}" &&
find "${fn}" -type f -not -path '*/__pycache__/*' |
sort
assert
)
)
if [[ -n ${diff} ]]; then
eqawarn "The directory ${fn} occludes package installed for ${EPYTHON}."
echo
echo ">>> Diff:"
echo "${diff}"
echo "<<< End-of-diff"
echo
eqawarn "The installed package includes additional files:"
eqawarn
while IFS= read -r l; do
eqawarn " ${l}"
done <<<"${diff}"
eqawarn
if [[ ! ${_PYTHON_WARNED_OCCLUDED_PACKAGES} ]]; then
eqawarn "The complete build log includes diffs."
eqawarn "For more information on occluded packages, please see:"
eqawarn "https://projects.gentoo.org/python/guide/test.html#importerrors-for-c-extensions"
_PYTHON_WARNED_OCCLUDED_PACKAGES=1