So, we have recently updated Python dist RPM generators in https://src.fedoraproject.org/rpms/python-rpm-generators/pull-request/30 Apparently, this fails very much with Python 3.10.0a5: Traceback (most recent call last): File "/usr/lib/rpm/pythondistdeps.py", line 320, in <module> dist = Distribution(f) File "/usr/lib/rpm/pythondistdeps.py", line 56, in __init__ self.name = self.metadata['Name'] AttributeError: can't set attribute 'name' Traceback (most recent call last): File "/usr/lib/rpm/pythondistdeps.py", line 320, in <module> dist = Distribution(f) File "/usr/lib/rpm/pythondistdeps.py", line 56, in __init__ self.name = self.metadata['Name'] AttributeError: can't set attribute 'name' As with any other RPM dep generator, the failure does not fail the RPM build, just the provides/requires are missing.
This is a change in Python 3.10: $ python3.9 Python 3.9.2 (default, Feb 20 2021, 00:00:00) ... >>> from pathlib import Path >>> from importlib.metadata import PathDistribution >>> class Distribution(PathDistribution): ... def __init__(self, path): ... super(Distribution, self).__init__(Path(path)) ... self.name = self.metadata['Name'] ... >>> Distribution('a') <__main__.Distribution object at 0x7f6c33e29a60> $ python3.10 Python 3.10.0a5 (default, Feb 3 2021, 14:01:21) ... >>> from pathlib import Path >>> from importlib.metadata import PathDistribution >>> class Distribution(PathDistribution): ... def __init__(self, path): ... super(Distribution, self).__init__(Path(path)) ... self.name = self.metadata['Name'] ... >>> Distribution('a') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<stdin>", line 4, in __init__ AttributeError: can't set attribute 'name'
https://src.fedoraproject.org/rpms/python-rpm-generators/blob/rawhide/f/pythondistdeps.py#_56 A solution might be to use a wrapper class instead of inheritance.
https://src.fedoraproject.org/rpms/python-rpm-generators/pull-request/34 is used in Python 3.10 copr, hence no longer urgent.
We have found one more problem with the new generators. python3-pip provides: … some bundled stuff … pip = 21.0.1-1.fc35 python-pip = 21.0.1-1.fc35 python3-pip = 21.0.1-1.fc35 python3.10dist(pip) = 21.0.1 python3.9-pip = 21.0.1-1.fc35 Which is wrong. There is no python3dist(pip) which is required by all projects using pyproject-rpm-macros, and there is python3.9-pip for some unknown reason. I'm talking about this build: https://copr.fedorainfracloud.org/coprs/g/python/python3.10/build/2014234/
> there is python3.9-pip for some unknown reason. https://src.fedoraproject.org/rpms/python-rpm-generators/blob/rawhide/f/pythonname.attr
Both the generators use the value of %__default_python3_version to determine, well, the default Python 3 version. When the macro is set to 3.9, python3-foo provides python3.9-foo and Python 3.10 packages *don't* provide python3dist(foo). When the macro is set to 3.10, python3-foo provides python3.10-foo and Python 3.10 packages provide python3dist(foo). The macro is set in the python-srpm-macros package, in the /usr/lib/rpm/macros.d/macros.python-srpm file. In Python 3.10 copr, the package is set to build from this PR: https://src.fedoraproject.org/rpms/python-rpm-macros/pull-request/84 Yet it seems the latest build in copr was not done from that PR, but from a SRPM instead. The SRPM has version 3.10, but sets %__default_python3_version to 3.9. Hence, the generators do what they are supposed to do.
> Yet it seems the latest build in copr was not done from that PR, but from a SRPM instead. The SRPM has version 3.10, but sets %__default_python3_version to 3.9. https://copr.fedorainfracloud.org/coprs/g/python/python3.10/build/2013583/
(In reply to Lumír Balhar from comment #4) > We have found one more problem with the new generators. python3-pip provides: > > … some bundled stuff … > pip = 21.0.1-1.fc35 > python-pip = 21.0.1-1.fc35 > python3-pip = 21.0.1-1.fc35 > python3.10dist(pip) = 21.0.1 > python3.9-pip = 21.0.1-1.fc35 > > Which is wrong. There is no python3dist(pip) which is required by all > projects using pyproject-rpm-macros, and there is python3.9-pip for some > unknown reason. This was fixed.
> The SRPM has version 3.10, but sets %__default_python3_version to 3.9. Prevention: https://src.fedoraproject.org/rpms/python-rpm-macros/pull-request/91
FEDORA-2021-1bbdfbcc31 has been submitted as an update to Fedora 34. https://bodhi.fedoraproject.org/updates/FEDORA-2021-1bbdfbcc31
FEDORA-2021-1bbdfbcc31 has been pushed to the Fedora 34 stable repository. If problem still persists, please make note of it in this bug report.