| |
| |
| %python3_pkgversion 3 |
| |
| |
| %__python3_other /bin/true |
| %py3_other_build /bin/true |
| %py3_other_install /bin/true |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| %python_wheel_pkg_prefix python%{?rhel:%{!?eln:%{python3_pkgversion}}} |
| %python_wheel_dir %{_datadir}/%{python_wheel_pkg_prefix}-wheels |
| |
| |
| |
| |
| |
| |
| |
| |
| %py_dist_name() %{lua:\ |
| name = rpm.expand("%{?1:%{1}}");\ |
| canonical = string.gsub(string.lower(name), "[^%w%.]+", "-");\ |
| print(canonical);\ |
| } |
| |
| |
| |
| |
| %py2_dist() %{lua:\ |
| args = {}\ |
| arg = 1\ |
| while (true) do\ |
| name = rpm.expand("%{?" .. arg .. ":%{" .. arg .. "}}");\ |
| if (name == nil or name == '') then\ |
| break\ |
| end\ |
| args[arg] = name\ |
| arg = arg + 1\ |
| end\ |
| for arg, name in ipairs(args) do\ |
| canonical = rpm.expand("%py_dist_name " .. name);\ |
| print("python2dist(" .. canonical .. ") ");\ |
| end\ |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| %_python3_pkgversion_with_dot %{lua:print((rpm.expand("%python3_pkgversion"):gsub('^3(%d)', '3.%1')))} |
| |
| |
| |
| |
| %py3_dist() %{lua:\ |
| python3_pkgversion_with_dot = rpm.expand("%_python3_pkgversion_with_dot")\ |
| args = {}\ |
| arg = 1\ |
| while (true) do\ |
| name = rpm.expand("%{?" .. arg .. ":%{" .. arg .. "}}");\ |
| if (name == nil or name == '') then\ |
| break\ |
| end\ |
| args[arg] = name\ |
| arg = arg + 1\ |
| end\ |
| for arg, name in ipairs(args) do\ |
| canonical = rpm.expand("%py_dist_name " .. name);\ |
| print("python" .. python3_pkgversion_with_dot .. "dist(" .. canonical .. ") ");\ |
| end\ |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| %__pypi_url https://files.pythonhosted.org/packages/source/ |
| %__pypi_default_extension tar.gz |
| |
| %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'):gsub('~', '') |
| 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) |
| } |
| |
| |
| |
| %py_provides() %{lua: |
| 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') |
| } |