The CheckPythonRequires check uses a compiled regex to check the package dependencies:
CheckPythonRequires
regex = re.compile("(^python-)|(-python$)|(-python-)", re.M)
The last pattern in the regex OR ((-python-)) produces false positive unversioned dependency warnings for packages that depend on other packages with this string in the name. In my case the package triggering the failure is "python3-dbus-python-client-gen" - which is clearly versioned.
(-python-)
Issues: ======= - Packages MUST NOT have dependencies (either build-time or runtime) on packages named with the unversioned python- prefix unless no properly versioned package exists. Dependencies on Python packages instead MUST use names beginning with python2- or python3- as appropriate. Note: Unversionned Python dependency found. See: https://docs.fedoraproject.org/en-US/packaging- guidelines/Python/#_dependencies
As of Fedora 41 on x86-64 there are 42 packages that match this regex:
$ dnf list | grep -- '-python-' Updating and loading repositories: Repositories loaded. policycoreutils-python-utils.noarch 3.7-7.fc41 <unknown> python3-dbus-python-client-gen.noarch 0.8.3-7.fc41 <unknown> sudo-python-plugin.x86_64 1.9.15-5.p5.fc41 <unknown> dbus-python-devel.i686 1.3.2-8.fc41 fedora dbus-python-devel.x86_64 1.3.2-8.fc41 fedora emacs-python-environment.noarch 0.0.2-10.fc41 fedora freeipa-python-compat.noarch 4.12.2-8.fc41 updates gdal-python-tools.x86_64 3.9.3-1.fc41 updates libarrow-python-devel.x86_64 16.1.0-12.fc41 updates libarrow-python-flight-devel.x86_64 16.1.0-12.fc41 updates libarrow-python-flight-libs.x86_64 16.1.0-12.fc41 updates libarrow-python-libs.x86_64 16.1.0-12.fc41 updates nautilus-python-devel.i686 4.0.1-3.fc41 fedora nautilus-python-devel.x86_64 4.0.1-3.fc41 fedora nbdkit-python-plugin.x86_64 1.40.5-2.fc41 updates nemo-python-devel.x86_64 6.4.0-1.fc41 updates nordugrid-arc-arex-python-lrms.x86_64 6.21.1-1.fc41 updates openqa-python-scripts.noarch 4.6^20240729gitd5cf789-5.fc41 updates python3-atlassian-python-api.noarch 3.41.14-2.fc41 fedora python3-colcon-python-setup-py.noarch 0.2.9-1.fc41 updates python3-domdf-python-tools.noarch 3.7.0-4.fc41 fedora python3-libdnf5-python-plugins-loader.x86_64 5.2.12.0-1.fc41 updates python3-python-fcl.x86_64 0.7.0.8-4.fc41 updates python3-python-multipart.noarch 0.0.20-1.fc41 updates python3-python-string-utils.noarch 1.0.0-17.fc41 fedora python3-python-ulid.noarch 2.7.0-4.fc41 fedora python3-python-ulid+pydantic.noarch 2.7.0-4.fc41 fedora python3-receptor-python-worker.x86_64 1.4.8-2.fc41 fedora python3-ssh-python-doc.x86_64 1.0.0-9.fc41 fedora rust-python-launcher+default-devel.noarch 1.0.1-2.fc41 fedora rust-python-launcher-devel.noarch 1.0.1-2.fc41 fedora rust-python-pkginfo+bzip2-devel.noarch 0.6.5-1.fc41 updates rust-python-pkginfo+default-devel.noarch 0.6.5-1.fc41 updates rust-python-pkginfo+deprecated-formats-devel.noarch 0.6.5-1.fc41 updates rust-python-pkginfo+serde-devel.noarch 0.6.5-1.fc41 updates rust-python-pkginfo+xz-devel.noarch 0.6.5-1.fc41 updates rust-python-pkginfo-devel.noarch 0.6.5-1.fc41 updates rust-tree-sitter-python-devel.noarch 0.23.6-1.fc41 updates syslog-ng-python-modules.x86_64 4.8.1-1.fc41 updates texlive-python-doc.noarch 11:svn60162-73.fc41 fedora xtensor-python-devel.i686 0.26.0-6.fc41 fedora xtensor-python-devel.x86_64 0.26.0-6.fc41 fedora
Some of these should possibly be renamed to better comply with the packaging guidelines (I'm not familiar with all of them so I can't say for sure), but others are clearly versioned and following the python3-%{name} convention.
python3-%{name}
It should be possible to exclude requirements that also match a python3|rust-python regex. Would you be willing to implement that?
python3|rust-python
That was kinda what I had in mind - thanks for confirming it's on the right track. I'm happy to have a go - I'll try to put a PR together, although it might be later this week.
I played around with two approaches for this - first, extending the regex to use negative lookahead to filter out packages beginning with python3- or rust-python- (a bit obscure...). This makes the regex a bit more complex/harder to read, but it's equally as efficient as the current version, making the last fragment:
python3-
rust-python-
^(?!(python3-|rust-python)).*-python-.*
The other approach was to add a new regex, and filter the results of the first regex through the second. This is perhaps a bit more readable, but it does mean we have to do rx.findall() on the main regex in order to properly check for unversioned dependencies.
rx.findall()
Any preference either way? I should be able to put a pull request together for this this week.
No preference :)
Log in to comment on this ticket.