diff --git a/macros.python-srpm b/macros.python-srpm index 19516ba..b3a1247 100644 --- a/macros.python-srpm +++ b/macros.python-srpm @@ -149,12 +149,8 @@ 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 + local provides = python.python_altprovides(name, evr) + for i, provide in ipairs(provides) do + print('Provides: ' .. provide .. '\\n') end } diff --git a/python.lua b/python.lua index 45cd366..8766c91 100644 --- a/python.lua +++ b/python.lua @@ -31,6 +31,11 @@ end -- Uses python_altnames under the hood -- Returns a table/array with strings. local function python_altprovides(name, evr) + -- global cache that tells what provides were already processed + if __python_altnames_provides_beenthere == nil then + __python_altnames_provides_beenthere = {} + end + __python_altnames_provides_beenthere[name .. ' ' .. evr] = true local altprovides = {} for i, altname in ipairs(python_altnames(name)) do table.insert(altprovides, altname .. ' = ' .. evr) @@ -41,6 +46,7 @@ end -- Like python_altprovides but only return something once. -- For each argument can only be used once, returns nil otherwise. +-- Previous usage of python_altprovides counts as well. local function python_altprovides_once(name, evr) -- global cache that tells what provides were already processed if __python_altnames_provides_beenthere == nil then