commit:     b86872a25614ca16177ca161638d8a0837cbda37
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 27 16:39:06 2025 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Thu Feb 27 16:39:06 2025 +0000
URL:        
https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=b86872a2

PythonCompatUpdate: ignore *t targets (freethreading)

Resolves: https://github.com/pkgcore/pkgcheck/issues/711
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 src/pkgcheck/checks/python.py                           | 14 +++++++++-----
 testdata/repos/python/profiles/desc/python_targets.desc |  1 +
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/pkgcheck/checks/python.py b/src/pkgcheck/checks/python.py
index 392241b2..755272f0 100644
--- a/src/pkgcheck/checks/python.py
+++ b/src/pkgcheck/checks/python.py
@@ -577,7 +577,7 @@ class PythonCompatCheck(Check):
     ``python-any-r1``.
     """
 
-    known_results = frozenset([PythonCompatUpdate])
+    known_results = frozenset({PythonCompatUpdate})
 
     whitelist_backports = frozenset(
         {
@@ -600,15 +600,19 @@ class PythonCompatCheck(Check):
         # determine available PYTHON_TARGET use flags
         targets = []
         for target, _desc in repo.use_expand_desc.get(IUSE_PREFIX[:-1], ()):
-            if target[len(IUSE_PREFIX) :].startswith("python"):
-                targets.append(target[len(IUSE_PREFIX) :])
+            target = target.removeprefix(IUSE_PREFIX)
+            if target.startswith("python"):
+                targets.append(target)
+        targets = (x for x in targets if not x.endswith("t"))
         multi_targets = tuple(sorted(targets, key=self.sorter))
 
         # determine available PYTHON_SINGLE_TARGET use flags
         targets = []
         for target, _desc in repo.use_expand_desc.get(IUSE_PREFIX_S[:-1], ()):
-            if target[len(IUSE_PREFIX_S) :].startswith("python"):
-                targets.append(target[len(IUSE_PREFIX_S) :])
+            target = target.removeprefix(IUSE_PREFIX_S)
+            if target.startswith("python"):
+                targets.append(target)
+        targets = (x for x in targets if not x.endswith("t"))
         single_targets = tuple(sorted(targets, key=self.sorter))
 
         self.params = {

diff --git a/testdata/repos/python/profiles/desc/python_targets.desc 
b/testdata/repos/python/profiles/desc/python_targets.desc
index 8e55f2da..3f87ee55 100644
--- a/testdata/repos/python/profiles/desc/python_targets.desc
+++ b/testdata/repos/python/profiles/desc/python_targets.desc
@@ -4,4 +4,5 @@ python3_7 - Build with Python 3.7
 python3_8 - Build with Python 3.8
 python3_9 - Build with Python 3.9
 python3_10 - Build with Python 3.10
+python3_13t - Build with Python 3.13 freethreading
 pypy3 - Build for PyPy3 only

Reply via email to