While I was reviewing python-pypdf [1] I noticed that the produced rpm (python3-pypdf) does not contain the license file, that is "rpm -q --licensefiles" comes up empty.
As far as I can tell the package follows the example spec file [2] which does not feature an explicit %license tag so I guess the %pyproject macros are supposed to pick these up automatically?
As for python-pypdf, the license file IS present in Python's dist-info directory.
The release tarball uses pyproject.toml with the following line:
license = { file = "LICENSE" }
Am I misunderstanding something here or could this be a shortcoming in the current macros?
Felix
[1] https://bugzilla.redhat.com/show_bug.cgi?id=2279080 [2] https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_example_s...
Hi Felix,
The missing bit is whether the build backend of pypdf exposes the metadata that pyproject-rpm-macros use to detect the license file. pypdf uses flit-core as its build backend which doesn't implement `License-File` field (it's a part of PEP 639, still in draft and implemented only in a subset of build backends, like setuptools and hatch). Hopefully in the future it'll become a standard.
For now, you've got to declare the license file via the %license macro manually.
See "Generating the %files section" of https://src.fedoraproject.org/rpms/pyproject-rpm-macros/blob/rawhide/f/READM... for more details.
Karolina
On 5/29/24 08:35, Felix Schwarz wrote:
While I was reviewing python-pypdf [1] I noticed that the produced rpm (python3-pypdf) does not contain the license file, that is "rpm -q --licensefiles" comes up empty.
As far as I can tell the package follows the example spec file [2] which does not feature an explicit %license tag so I guess the %pyproject macros are supposed to pick these up automatically?
As for python-pypdf, the license file IS present in Python's dist-info directory.
The release tarball uses pyproject.toml with the following line:
license = { file = "LICENSE" }
Am I misunderstanding something here or could this be a shortcoming in the current macros?
Felix
[1] https://bugzilla.redhat.com/show_bug.cgi?id=2279080 [2] https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_example_s... --
On 29. 05. 24 9:48, Karolina Surma wrote:
Hi Felix,
The missing bit is whether the build backend of pypdf exposes the metadata that pyproject-rpm-macros use to detect the license file. pypdf uses flit-core as its build backend which doesn't implement `License-File` field (it's a part of PEP 639, still in draft and implemented only in a subset of build backends, like setuptools and hatch). Hopefully in the future it'll become a standard.
For now, you've got to declare the license file via the %license macro manually.
See "Generating the %files section" of https://src.fedoraproject.org/rpms/pyproject-rpm-macros/blob/rawhide/f/READM... for more details.
Most importantly, this paragraph:
""" %pyproject_save_files can automatically mark license files with %license macro and language (*.mo) files with %lang macro and appropriate language code. Only license files declared via PEP 639 License-File field are detected. PEP 639 is still a draft and can be changed in the future. It is possible to use the -l flag to declare that a missing license should terminate the build or -L (the default) to explicitly disable this check. Packagers are encouraged to use the -l flag when the %license file is not manually listed in %files to avoid accidentally losing the file in a future version. When the %license file is manually listed in %files, packagers can use the -L flag to ensure future compatibility in case the -l behavior eventually becomes a default. """
Karolina, Miro,
thank you both for the explanation. I added that information in the review request.
Felix
python-devel@lists.fedoraproject.org