python3 is not available in epel7

This commit is contained in:
Moez Roy 2014-10-05 01:37:25 -07:00
parent f0aeace6b4
commit 360daf2c15

View File

@ -1,4 +1,4 @@
%if 0%{?fedora} || 0%{?rhel} >= 7
%if 0%{?fedora} || 0%{?rhel} >= 8
%global __python_sitelib %{python2_sitelib}
%else
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
@ -30,7 +30,7 @@ BuildRequires: python2-devel
BuildRequires: python-setuptools
BuildRequires: python-construct
%if 0%{?fedora} || 0%{?rhel} >= 7
%if 0%{?fedora} || 0%{?rhel} >= 8
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-construct
@ -53,7 +53,7 @@ Pure-Python library for parsing and analyzing ELF files
and DWARF debugging information.
%if 0%{?fedora} || 0%{?rhel} >= 7
%if 0%{?fedora} || 0%{?rhel} >= 8
%package -n python3-%{name}
Summary: Pure-Python library for parsing and analyzing ELF files
@ -74,7 +74,7 @@ and DWARF debugging information.
rm -rf elftools/construct
# python3-package
%if 0%{?fedora} || 0%{?rhel} >= 7
%if 0%{?fedora} || 0%{?rhel} >= 8
rm -rf %{py3dir}
cp -a . %{py3dir}
@ -88,7 +88,7 @@ sed -i -e 's|#!/usr/bin/env python|#!/usr/bin/python2|' scripts/readelf.py
%build
%{__python2} setup.py build
%if 0%{?fedora} || 0%{?rhel} >= 7
%if 0%{?fedora} || 0%{?rhel} >= 8
pushd %{py3dir}
%{__python3} setup.py build
%endif
@ -98,7 +98,7 @@ pushd %{py3dir}
%{__python2} setup.py install -O1 --skip-build --root %{buildroot}
mv %{buildroot}/usr/bin/readelf.py %{buildroot}/usr/bin/pyreadelf
%if 0%{?fedora} || 0%{?rhel} >= 7
%if 0%{?fedora} || 0%{?rhel} >= 8
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
mv %{buildroot}/usr/bin/readelf.py %{buildroot}/usr/bin/py3readelf
@ -113,7 +113,7 @@ mv %{buildroot}/usr/bin/readelf.py %{buildroot}/usr/bin/py3readelf
# https://github.com/eliben/pyelftools/wiki/Hacking-guide#tests
%{__python2} test/run_readelf_tests.py || :
%if 0%{?fedora} || 0%{?rhel} >= 7
%if 0%{?fedora} || 0%{?rhel} >= 8
%{__python3} test/run_all_unittests.py
%{__python3} test/run_examples_test.py
# tests may fail because of differences in output-formatting
@ -128,7 +128,7 @@ mv %{buildroot}/usr/bin/readelf.py %{buildroot}/usr/bin/py3readelf
%{__python_sitelib}/*elftools*
%{_bindir}/pyreadelf
%if 0%{?fedora} || 0%{?rhel} >= 7
%if 0%{?fedora} || 0%{?rhel} >= 8
%files -n python3-%{name}
%doc CHANGES LICENSE README* TODO
%{python3_sitelib}/*elftools*