public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: "Michał Górny" <mgorny@gentoo.org>
Subject: [gentoo-dev] [PATCH 5/5] distutils-r1.eclass: QA-warn about invalid package versions
Date: Thu,  4 Jan 2024 18:09:34 +0100	[thread overview]
Message-ID: <20240104170934.106565-5-mgorny@gentoo.org> (raw)
In-Reply-To: <20240104170934.106565-1-mgorny@gentoo.org>

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 eclass/distutils-r1.eclass | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 014669c8c47c..e0a91001ef1f 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -2089,14 +2089,33 @@ _distutils-r1_post_python_install() {
 
 	local sitedir=${D%/}$(python_get_sitedir)
 	if [[ -d ${sitedir} ]]; then
+		local p
 		_distutils-r1_strip_namespace_packages "${sitedir}"
 
+		local bad_versions=()
+		mapfile -d $'\0' -t bad_versions < <(
+			find "${sitedir}" -maxdepth 1 '(' \
+				-name '*-0.0.0.dist-info' -o \
+				-name '*-UNKNOWN.dist-info' -o \
+				-name '*-0.0.0.egg-info' -o \
+				-name '*-UNKNOWN.egg-info' \
+				')' -print0
+		)
+
+		if [[ -n ${bad_versions[@]} ]]; then
+			eqawarn "The following Python packages were installed with invalid/suspicious"
+			eqawarn "versions in the site-packages directory:"
+			eqawarn
+			for p in "${bad_versions[@]}"; do
+				eqawarn "  ${p##*/}"
+			done
+		fi
+
 		local forbidden_package_names=(
 			examples test tests
 			.pytest_cache .hypothesis _trial_temp
 		)
 		local strays=()
-		local p
 		mapfile -d $'\0' -t strays < <(
 			find "${sitedir}" -maxdepth 1 -type f '!' '(' \
 					-name '*.egg-info' -o \
-- 
2.43.0



      parent reply	other threads:[~2024-01-04 17:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-04 17:09 [gentoo-dev] [PATCH 1/5] python-utils-r1.eclass: Minimize pytest tempdir retention Michał Górny
2024-01-04 17:09 ` [gentoo-dev] [PATCH 2/5] dev-python/tox: epytest now takes care of removing tempdir Michał Górny
2024-01-04 17:09 ` [gentoo-dev] [PATCH 3/5] python-utils-r1.eclass, distutils-r1.eclass: Add EPYTEST_TIMEOUT Michał Górny
2024-01-04 17:09 ` [gentoo-dev] [PATCH 4/5] dev-python/trimesh: Use EPYTEST_TIMEOUT Michał Górny
2024-01-04 17:09 ` Michał Górny [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240104170934.106565-5-mgorny@gentoo.org \
    --to=mgorny@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox