pkgcheck icon indicating copy to clipboard operation
pkgcheck copied to clipboard

PythonCompatUpdate check doesn't understand python_gen_cond_dep (confused by unittest-or-fail dep for Python 3.12)

Open thesamesam opened this issue 2 years ago • 1 comments

pkgcheck doesn't seem to emit a PythonCompatUpdate result for me on dev-python/jinga2_pluralize at commit fd6b3fcdbc4106ca78401042f5e93e561263d458:

$ git checkout fd6b3fcdbc4106ca78401042f5e93e561263d458
$ pkgcheck scan
[nothing]
$ grep -rsn 12 jinja2_pluralize-0.3.0-r1.ebuild
[nothing]
$ gpy-py3.12
-PYTHON_COMPAT=( python3_{9..11} )
+PYTHON_COMPAT=( python3_{10..12} )
$ pkgcheck scan
[nothing]
$ pkgcheck --version
pkgcheck 0.10.25-2-g4166bfd -- Fri, 19 May 2023 20:02:52 +0300

thesamesam avatar Jun 02 '23 01:06 thesamesam

With some debugging prints:

$ diff -ruN /usr/lib/python3.1{1,2}/site-packages/pkgcheck/checks/python.py
--- /usr/lib/python3.11/site-packages/pkgcheck/checks/python.py 2023-05-27 11:28:51.836670913 +0100
+++ /usr/lib/python3.12/site-packages/pkgcheck/checks/python.py 2023-06-02 03:01:20.088183173 +0100
@@ -659,18 +659,26 @@
             try:
                 # determine if deps support missing python targets
                 for dep in self.python_deps(deps, prefix):
+                    print("here!")
                     # TODO: use query caching for repo matching?
                     latest = sorted(self.options.search_repo.match(dep))[-1]
-                    targets.intersection_update(
+                    y = [
                         f"python{x.rsplit('python', 1)[-1]}"
                         for x in latest.iuse_stripped
                         if x.startswith(prefix)
-                    )
+                    ]
+                    print(f"{targets=}")
+                    print(f"{y=}")
+                    targets.intersection_update(y)
                     if not targets:
+                        print(f"{dep=}")
+                        print("not targets")
                         return
             except IndexError:
+                print("indexerror!")
                 return

+            print("yielding...")
             yield PythonCompatUpdate(sorted(targets, key=self.sorter), pkg=pkg)

We get:

$ pkgcheck scan
here!
targets={'python3_12'}
y=['python3_12', 'python3_10', 'python_targets_pypy3', 'python3_11']
here!
targets={'python3_12'}
y=['python3_10', 'python3_11', 'python_targets_pypy3']
dep=<atom dev-python/unittest-or-fail @#7f00a915be30>
not targets

... so it's confused by dev-python/unittest-or-fail being a conditional dep (via python_gen_cond_dep) in distutils-r1.eclass. python_deps() in pkgcheck/checks/python.py doesn't seem to understand gen_cond_dep at all?

thesamesam avatar Jun 02 '23 02:06 thesamesam