commit:     aa44ace6db754dce8224fae2cc2e62792a83cc30
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 25 14:14:31 2025 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Oct 25 14:16:43 2025 +0000
URL:        https://gitweb.gentoo.org/proj/gpyutils.git/commit/?id=aa44ace6

list_pkg_impls: Include python_test state

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 gpyutils/scripts/list_pkg_impls.py | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/gpyutils/scripts/list_pkg_impls.py 
b/gpyutils/scripts/list_pkg_impls.py
index 63108ac..0462736 100755
--- a/gpyutils/scripts/list_pkg_impls.py
+++ b/gpyutils/scripts/list_pkg_impls.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 # gpyutils
-# (c) 2013-2024 Michał Górny <[email protected]>
+# (c) 2013-2025 Michał Górny <[email protected]>
 # SPDX-License-Identifier: GPL-2.0-or-later
 
 import sys
@@ -37,18 +37,23 @@ def process(pkgs):
                 if cl == PackageClass.stable:
                     st_impls = [x.short_name for x in impls]
             if ptype is None:
-                if "distutils-r1" in p.inherits:
+                ptype = "(legacy)"
+                test = " "
+
+                if "distutils-r1" in p.inherits or "test" not in p.restrict:
                     with open(p.path) as f:
                         for x in f:
                             if x.startswith("DISTUTILS_USE_PEP517="):
                                 ptype = "(PEP517)"
+                            if x.startswith(("distutils_enable_tests ",
+                                             "python_test()")):
+                                test = "T"
+                                # we do not need to scan for anything else
                                 break
-                            if x.startswith("inherit "):
-                                ptype = "(legacy)"
-                                break
-                        else:
-                            ptype = "(legacy)"
-                else:
+
+                if "test" in p.restrict:
+                    test = "r"
+                if "distutils-r1" not in p.inherits:
                     ptype = "        "
 
             if kw_impls and st_impls:
@@ -66,6 +71,8 @@ def process(pkgs):
         assert ptype is not None
         out.append(ptype)
 
+        out.append(test)
+
         if st_impls:
             out.append(" STABLE:")
             out.extend(st_impls)

Reply via email to