Advertisement
Guest User

Untitled

a guest
Feb 27th, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. %pypi_source() %{lua:
  2.     local src = rpm.expand('%1')
  3.     local ver = rpm.expand('%2')
  4.     local ext = rpm.expand('%3')
  5.     local url = rpm.expand('%__pypi_url')
  6. \
  7.     -- If no first argument, try %srcname, then %pypi_name, then %name
  8.     -- Note that rpm leaves macros unchanged if they are not defined.
  9.     if src == '%1' then
  10.         src = rpm.expand('%srcname')
  11.     end
  12.     if src == '%srcname' then
  13.         src = rpm.expand('%pypi_name')
  14.     end
  15.     if src == '%pypi_name' then
  16.         src = rpm.expand('%name')
  17.     end
  18. \
  19.     -- If no second argument, use %version
  20.     if ver == '%2' then
  21.         ver = rpm.expand('%version')
  22.     end
  23. \
  24.     -- If no third argument, use the preset default extension
  25.     if ext == '%3' then
  26.         ext = rpm.expand('%__pypi_default_extension')
  27.     end
  28. \
  29.     local first = string.sub(src, 1, 1)
  30. \
  31.     print(url .. first .. '/' .. src .. '/' .. src .. '-' .. ver .. '.' .. ext)
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement