python-rpm-generators/pythonname.attr
Miro Hrončok bbfe4930d9 Automatically call %python_provide
This allows us to drop the %python_provide macro from most spec files,
except where we want to use it for virtual provides or empty packages.
2020-04-03 16:06:46 +02:00

21 lines
935 B
Plaintext

%__pythonname_provides() %{lua:
-- this macro is called for each file in a package, the path being in %1
-- but we don't need to know the path, so we would get for each file: Macro %1 defined but not used within scope
-- in here, we expand %name conditionally on %1 to suppress the warning
local name = rpm.expand('%{?1:%{name}}')
-- a structure that knows what names were already processed, so we can end early
if __pythonname_beenthere == nil then
__pythonname_beenthere = {}
end
-- we save ourselves a trip to %python_provide if we have already been there
if __pythonname_beenthere[name] == nil then
local python_provide = rpm.expand('%{?python_provide:%python_provide %{name}}')
for provides in python_provide:gmatch('Provides:[ \\t]+([^\\n]+)') do
print(provides .. " ")
end
__pythonname_beenthere[name] = true
end
}
%__pythonname_path ^/