Hello Pythonistas,
pyproject-rpm-macros 1.14.0 landed in Fedora Rawhide and ELN.
It defines a provisional Declarative Buildsystem for RPM 4.20+.
It allows you to write Python specfiles like this:
--------------------------------- Name: python-pello Version: 1.0.4 Release: %autorelease Summary: Example Python library License: MIT-0 URL: https://github.com/fedora-python/Pello Source: %{url}/archive/v%{version}/Pello-%{version}.tar.gz BuildSystem: pyproject BuildOption(install): -l pello BuildArch: noarch
%description ...
%package -n python3-pello Summary: %{summary}
%description -n python3-pello ...
%files -n python3-pello -f %{pyproject_files} %doc README.md %{_bindir}/pello_greeting ---------------------------------
It will fill-in %prep, %generate_buildrequires, %build, %install, and %check sections for you. Yet you can configure/extend/override the sections if needed.
Read about all the possibilities at https://src.fedoraproject.org/rpms/pyproject-rpm-macros/blob/rawhide/f/READM... in the *Provisional: Declarative Buildsystem (RPM 4.20+)* section.
This is still *provisional* and the API might change in the future.
Beware that RPM in Fedora 39/40 and EPELs does not understand this and RPM < 4.20 will not parse such spec files, so this is inconvenient to use unless you run Rawhide -- fedpkg prep, rpmbuild -bs, spectool -g, rpmdev-bumpspec won't work properly...
If you don't use Rawhide, you can build a SRPM like this:
mock -r fedora-rawhide-x86_64 --enablerepo=local --resultdir=./ --buildsrpm --spec python-pello.spec --source Pello-1.0.4.tar.gz
Or use fedpkg with --srpm-mock.
However, even some infra tools that don't run on Rawhide will likely fail with a package like this (e.g. Copr or Zuul). Use this at your own risk. Koji builds SRPMs for Rawhide on Rawhide, so it works there.
Please experiment with this and report back how does it work for you.
Happy packaging.
On 25. 07. 24 23:13, Miro Hrončok wrote:
However, even some infra tools that don't run on Rawhide will likely fail with a package like this (e.g. Copr or Zuul). Use this at your own risk. Koji builds SRPMs for Rawhide on Rawhide, so it works there.
I just found out Koji will fail buildSRPMFromSCM whent he spec file uses %autorelease/%autochangelog with BuildSystem because the rpmautospec plugin cannot parse spec files with RPM 4.20+ features.
Reported as:
https://pagure.io/fedora-infrastructure/issue/12126
python-devel@lists.fedoraproject.org