Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %pypi_source() %{lua:
- local src = rpm.expand('%1')
- local ver = rpm.expand('%2')
- local ext = rpm.expand('%3')
- local url = rpm.expand('%__pypi_url')
- \
- -- If no first argument, try %srcname, then %pypi_name, then %name
- -- Note that rpm leaves macros unchanged if they are not defined.
- if src == '%1' then
- src = rpm.expand('%srcname')
- end
- if src == '%srcname' then
- src = rpm.expand('%pypi_name')
- end
- if src == '%pypi_name' then
- src = rpm.expand('%name')
- end
- \
- -- If no second argument, use %version
- if ver == '%2' then
- ver = rpm.expand('%version')
- end
- \
- -- If no third argument, use the preset default extension
- if ext == '%3' then
- ext = rpm.expand('%__pypi_default_extension')
- end
- \
- local first = string.sub(src, 1, 1)
- \
- print(url .. first .. '/' .. src .. '/' .. src .. '-' .. ver .. '.' .. ext)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement