rename binaries to conform to Python packaging guidelines

This commit is contained in:
Dominik 'Rathann' Mierzejewski 2019-12-17 13:39:36 +01:00
parent b37dece1d1
commit 2d2306a640

View File

@ -1,9 +1,11 @@
%if 0%{?fedora} || 0%{?rhel} >= 8
%global py2readelf py2readelf
%global py3readelf pyreadelf
%global py2readelf %{nil}
%global py3readelf %{_bindir}/pyreadelf
%global pyreadelf pyreadelf-3
%else
%global py2readelf pyreadelf
%global py3readelf py3readelf
%global py2readelf %{_bindir}/pyreadelf
%global py3readelf %{nil}
%global pyreadelf pyreadelf-2
%endif
%if 0%{?fedora} && 0%{?fedora} < 32
@ -72,12 +74,21 @@ BuildArch: noarch
%install
%if 0%{?with_python2}
%{py2_install}
mv %{buildroot}/usr/bin/readelf.py %{buildroot}/usr/bin/%{py2readelf}
pushd %{buildroot}%{_bindir}
mv readelf.py pyreadelf-%{python2_version}
ln -s pyreadelf-%{python2_version} pyreadelf-2
popd
%endif
%if 0%{?with_python3}
%{py3_install}
mv %{buildroot}/usr/bin/readelf.py %{buildroot}/usr/bin/%{py3readelf}
pushd %{buildroot}%{_bindir}
mv readelf.py pyreadelf-%{python3_version}
ln -s pyreadelf-%{python3_version} pyreadelf-3
popd
%endif
pushd %{buildroot}%{_bindir}
ln -s %{pyreadelf} pyreadelf
popd
%check
%if 0%{?with_python2}
@ -103,7 +114,9 @@ mv %{buildroot}/usr/bin/readelf.py %{buildroot}/usr/bin/%{py3readelf}
%files -n python2-%{name}
%license LICENSE
%doc CHANGES
%{_bindir}/%{py2readelf}
%{py2readelf}
%{_bindir}/pyreadelf-%{python2_version}
%{_bindir}/pyreadelf-2
%{python2_sitelib}/elftools
%{python2_sitelib}/pyelftools-*.egg-info
%endif
@ -112,7 +125,9 @@ mv %{buildroot}/usr/bin/readelf.py %{buildroot}/usr/bin/%{py3readelf}
%files -n python3-%{name}
%license LICENSE
%doc CHANGES
%{_bindir}/%{py3readelf}
%{py3readelf}
%{_bindir}/pyreadelf-%{python3_version}
%{_bindir}/pyreadelf-3
%{python3_sitelib}/elftools
%{python3_sitelib}/pyelftools-*.egg-info
%endif
@ -123,6 +138,7 @@ mv %{buildroot}/usr/bin/readelf.py %{buildroot}/usr/bin/%{py3readelf}
- make main package archful to run tests on all arches
(pythonN-pyelftools subpackages are still noarch)
- run readelf tests on x86_64 only for now
- rename binaries to conform to Python packaging guidelines
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 0.25-5
- Rebuilt for Python 3.8.0rc1 (#1748018)