diff --git a/macros.python-srpm b/macros.python-srpm index 67e53c9..19516ba 100644 --- a/macros.python-srpm +++ b/macros.python-srpm @@ -137,3 +137,24 @@ \ print(url .. first .. '/' .. src .. '/' .. src .. '-' .. ver .. '.' .. ext) } + +%py_provides() %{lua: + local python = require 'fedora.srpm.python' + local name = rpm.expand('%1') + if name == '%1' then + rpm.expand('%{error:%%py_provides requires at least 1 argument, the name to provide}') + end + local evr = rpm.expand('%2') + if evr == '%2' then + evr = rpm.expand('%{?epoch:%{epoch}:}%{version}-%{release}') + end + print('Provides: ' .. name .. ' = ' .. evr .. '\\n') + local provides = python.python_altprovides_once(name, evr) + -- provides is either an array/table or nil + -- nil means the function was already called with the same arguments + if provides then + for i, provide in ipairs(provides) do + print('Provides: ' .. provide .. '\\n') + end + end +} diff --git a/python-rpm-macros.spec b/python-rpm-macros.spec index 94dad05..024a45d 100644 --- a/python-rpm-macros.spec +++ b/python-rpm-macros.spec @@ -1,6 +1,6 @@ Name: python-rpm-macros Version: 3.8 -Release: 4%{?dist} +Release: 5%{?dist} Summary: The common Python RPM macros # macros and lua: MIT, compileall2.py: PSFv2 @@ -107,6 +107,9 @@ install -m 644 compileall2.py %{buildroot}%{_rpmconfigdir}/redhat/ %changelog +* Tue May 05 2020 Miro HronĨok - 3.8-5 +- Implement %%py_provides + * Mon May 04 2020 Tomas Hrnciar - 3.8-4 - Make %%py3_install_wheel macro remove direct_url.json file created by PEP 610. - https://discuss.python.org/t/pep-610-usage-guidelines-for-linux-distributions/4012