Backport %py_shebang_fix, %pytest, %py_provides

epel9
Miro Hrončok 5 years ago
parent 93fbfe9fd3
commit 054c9b6b80

@ -1,6 +1,6 @@
Name: epel-rpm-macros Name: epel-rpm-macros
Version: 8 Version: 8
Release: 11 Release: 12
Summary: Extra Packages for Enterprise Linux RPM macros Summary: Extra Packages for Enterprise Linux RPM macros
Group: System Environment/Base Group: System Environment/Base
@ -60,6 +60,9 @@ install -Dpm 644 %{SOURCE3} \
%changelog %changelog
* Sun Jun 07 2020 Miro Hrončok <mhroncok@redhat.com> - 8-12
- Backport %%py_shebang_fix, %%pytest, %%py_provides
* Thu Apr 30 2020 Troy Dawson <tdawson@redhat.com> - 8-11 * Thu Apr 30 2020 Troy Dawson <tdawson@redhat.com> - 8-11
- Install python36-rpm-macros or python38-rpm-macros correctly - Install python36-rpm-macros or python38-rpm-macros correctly

@ -20,6 +20,11 @@
%python2 %__python2 %python2 %__python2
%python3 %__python3 %python3 %__python3
# Simplified version backported from Fedora
%py_shebang_fix %{expand:/usr/bin/pathfix.py -pni "%{__python} %{py_shbang_opts}"}
%py2_shebang_fix %{expand:/usr/bin/pathfix.py -pni "%{__python2} %{py2_shbang_opts}"}
%py3_shebang_fix %{expand:/usr/bin/pathfix.py -pni "%{__python3} %{py3_shbang_opts}"}
# Users can use %%python only if they redefined %%__python (e.g. to %%__python3) # Users can use %%python only if they redefined %%__python (e.g. to %%__python3)
%python() %{lua:\ %python() %{lua:\
__python = rpm.expand("%__python")\ __python = rpm.expand("%__python")\
@ -45,6 +50,32 @@
end end
} }
# This is intended for Python 3 only, hence also no Python version in the name.
%__pytest /usr/bin/pytest-3
%pytest %{expand:\\\
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
PATH="%{buildroot}%{_bindir}:$PATH"\\\
PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}}"\\\
PYTHONDONTWRITEBYTECODE=1\\\
%__pytest}
%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')
-- NB: dash needs to be escaped!
if name:match('^python3%-') then
replaced = name:gsub('^python3%-', 'python-')
print('Provides: ' .. replaced .. ' = ' .. evr .. '\\n')
end
}
# gpgverify verifies signed sources. There is documentation in the script. # gpgverify verifies signed sources. There is documentation in the script.
%gpgverify %{_rpmconfigdir}/gpgverify %gpgverify %{_rpmconfigdir}/gpgverify

Loading…
Cancel
Save