Implement %py_provides

This commit is contained in:
Miro Hrončok 2020-04-28 18:48:51 +02:00
parent 125134cf84
commit 8fea79b1ec
2 changed files with 25 additions and 1 deletions

View File

@ -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
}

View File

@ -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 <mhroncok@redhat.com> - 3.8-5
- Implement %%py_provides
* Mon May 04 2020 Tomas Hrnciar <thrnciar@redhat.com> - 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