public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: metadata/install-qa-check.d/
Date: Sat, 19 Apr 2025 01:27:55 +0000 (UTC)	[thread overview]
Message-ID: <1745022175.012e58054c1cb7a2f65a3959c8f42f191862585f.sam@gentoo> (raw)

commit:     012e58054c1cb7a2f65a3959c8f42f191862585f
Author:     Eli Schwartz <eschwartz <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 18 18:35:18 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Apr 19 00:22:55 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=012e5805

metadata/install-qa-check.d: fix python checks for non-distutils software

The existing check makes an intimidating value proposition: that all
software being checked was installed using distutils-r1.eclass, hence
moving the check from there as-is to a new home is sufficient. This
includes the use of functions specific to the distutils-r1 eclass
inheritance chain. In particular, get_modname is part of
multilib.eclass, which distutils-r1 inherits, but python-single-r1 does
not inherit.

This results in the following QA warning:

```
/var/db/repos/gentoo/metadata/install-qa-check.d/60python-site: line 53: get_modname: command not found
/var/db/repos/gentoo/metadata/install-qa-check.d/60python-site: line 53: get_modname: command not found
/var/db/repos/gentoo/metadata/install-qa-check.d/60python-site: line 53: get_modname: command not found
 * Verifying compiled files for python3.12
 *
 * QA Notice: Extensions found compiled for the wrong Python version
 * (likely broken build isolation):
 *
 *   /usr/lib/python3.12/site-packages/__pycache__/init_calibre.cpython-312.pyc
 *   /usr/lib/python3.12/site-packages/__pycache__/init_calibre.cpython-312.opt-1.pyc
 *   /usr/lib/python3.12/site-packages/__pycache__/init_calibre.cpython-312.opt-2.pyc
```

because we are matching all files matching "*.cpython*" that are also
named "*" instead of all files named "*$(get_modname)".

Instead of using multilib.eclass, go directly to the preferred canonical
source, and query cpython what *it* thinks a module extension should be.
This is also more flexible since cpython itself doesn't really guarantee
that extension modules are named anything like get_modname, but
generally equals -- for backwards compatibility -- the final value from
`_PyImport_DynLoadFiletab` / `_imp.extension_suffixes()` (and on
Windows, that is .pyd instead of .dll, though admittedly,
sysconfig.get_config_vars is pretty empty there; on the other hand, PyPy
doesn't recognize unadorned .so because it doesn't need the
compatibility, so we see that it's not really a guarantee, and might as
well go for the sysconfig variable which is unambiguous where present).

Signed-off-by: Eli Schwartz <eschwartz <AT> gentoo.org>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 metadata/install-qa-check.d/60python-site | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/metadata/install-qa-check.d/60python-site b/metadata/install-qa-check.d/60python-site
index 3791fa80ecdd..49d4b3a1a830 100644
--- a/metadata/install-qa-check.d/60python-site
+++ b/metadata/install-qa-check.d/60python-site
@@ -75,6 +75,13 @@ python_site_check() {
 		local sitedir=( "${pydir}"/site-packages )
 		[[ -d ${sitedir} ]] || continue
 
+		local modname=$(
+			"${impl}" - <<-EOF
+				import sysconfig
+				print(sysconfig.get_config_var("SHLIB_SUFFIX"))
+			EOF
+		)
+
 		# check for bad package versions
 		while IFS= read -d $'\0' -r f; do
 			bad_versions+=( "${f#${ED}}" )
@@ -107,7 +114,7 @@ python_site_check() {
 					-name '*.pth' -o \
 					-name '*.py' -o \
 					-name '*.pyi' -o \
-					-name "*$(get_modname)" -o \
+					-name "*${modname}" -o \
 					-name 'README.txt' \
 				')' -print0
 		)
@@ -130,8 +137,8 @@ python_site_check() {
 			wrong_ext+=( "${f#${ED}}" )
 		done < <(
 			find "${sitedir}" '(' \
-				-name "*.pypy*$(get_modname)" -o \
-				-name "*.cpython*$(get_modname)" \
+				-name "*.pypy*${modname}" -o \
+				-name "*.cpython*${modname}" \
 				')' -a '!' -name "*${ext_suffix}" -print0
 		)
 


             reply	other threads:[~2025-04-19  1:27 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-19  1:27 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-04-18 17:21 [gentoo-commits] repo/gentoo:master commit in: metadata/install-qa-check.d/ Michał Górny
2025-04-18 15:22 Arthur Zamarin
2025-04-16  0:54 Michał Górny
2025-04-16  0:54 Michał Górny
2024-10-21 15:12 Michał Górny
2024-09-05  8:43 Michał Górny
2024-03-29 18:47 Sam James
2024-01-08 14:48 Michał Górny
2024-01-08 14:48 Michał Górny
2024-01-08 14:48 Michał Górny
2024-01-08 14:48 Michał Górny
2024-01-08 14:48 Michał Górny
2024-01-08 14:48 Michał Górny
2024-01-08 14:48 Michał Górny
2024-01-08 14:48 Michał Górny
2024-01-08 14:48 Michał Górny
2023-08-17 22:08 Ulrich Müller
2023-05-17  3:40 Michał Górny
2022-09-19  3:52 Sam James
2022-08-21  2:31 Sam James
2022-08-04 23:49 Sam James
2022-08-03 18:56 Sam James
2022-08-03  4:27 Sam James
2022-08-03  1:53 Sam James
2022-08-02  4:08 Michał Górny
2022-07-16 11:26 Michał Górny
2022-06-08  0:25 Mike Gilbert
2022-05-06 12:48 Ionen Wolkens
2022-05-05 23:38 Sam James
2022-05-02  6:01 Agostino Sarubbo
2022-04-30 19:13 Sam James
2022-04-28  3:06 Sam James
2022-04-27  0:13 Sam James
2022-04-26 23:45 Sam James
2022-04-26 15:32 Sam James
2022-04-19 18:31 Sam James
2022-04-19 18:31 Sam James
2022-04-17 14:21 Sam James
2022-04-17 14:18 Sam James
2022-03-04  1:26 Sam James
2022-03-04  1:26 Sam James
2022-02-01 18:19 Mike Gilbert
2022-02-01  1:37 Mike Gilbert
2022-01-16  9:40 Michał Górny
2021-08-19  1:35 Sam James
2021-08-16  2:12 Sam James
2021-08-16  2:12 Sam James
2021-08-16  2:12 Sam James
2021-08-16  2:12 Sam James
2021-08-02  8:17 Michał Górny
2021-07-03  8:16 Michał Górny
2021-07-01  8:57 Georgy Yakovlev
2021-06-28 18:47 Georgy Yakovlev
2021-06-28  8:56 Georgy Yakovlev
2021-06-28  0:12 Georgy Yakovlev
2021-06-27  2:08 Sam James
2021-06-26 23:25 Georgy Yakovlev
2021-06-26 23:09 Georgy Yakovlev
2021-05-29 15:15 Michał Górny
2021-05-25  5:13 Michał Górny
2021-04-29 11:42 Michał Górny
2021-04-29 11:42 Michał Górny
2021-04-29 11:42 Michał Górny
2021-04-29 11:42 Michał Górny
2021-04-09 23:17 Sam James
2020-10-17 19:01 Michał Górny
2020-10-16  7:42 Michał Górny
2020-09-22 11:12 Michał Górny
2020-09-22  7:33 Michał Górny
2020-09-22  7:00 Michał Górny
2020-09-22  7:00 Michał Górny
2020-09-21 17:48 Michał Górny
2020-09-21 15:30 Michał Górny
2020-02-13 18:59 Georgy Yakovlev
2020-01-20 20:45 Michael Orlitzky
2019-12-30 16:10 Michał Górny
2019-11-12  7:53 Sergei Trofimovich
2019-11-11 23:05 Zac Medico
2019-11-11 22:25 Sergei Trofimovich
2019-11-01 13:16 Michał Górny
2018-10-06  8:35 Michał Górny

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=1745022175.012e58054c1cb7a2f65a3959c8f42f191862585f.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.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