%global srcname pyelftools
%global sum Library for analyzing ELF files and DWARF debugging information

Name:           python-%{srcname}
Version:        0.24
Release:        1%{?dist}
Summary:        %{sum}

License:        Public Domain
URL:            https://pypi.python.org/pypi/pyelftools
Source0:        https://pypi.python.org/packages/ba/78/d4a186a2e38731286c99dc3e3ca8123b6f55cf2e28608e8daf2d84b65494/%{srcname}-%{version}.tar.gz

BuildArch:      noarch
BuildRequires:  python2-devel python3-devel

%description
Library for analyzing ELF files and DWARF debugging information.

%package -n python2-%{srcname}
Summary:        %{sum}
%{?python_provide:%python_provide python2-%{srcname}}

%description -n python2-%{srcname}
Library for analyzing ELF files and DWARF debugging information.


%package -n python3-%{srcname}
Summary:        %{sum}
%{?python_provide:%python_provide python3-%{srcname}}

%description -n python3-%{srcname}
Library for analyzing ELF files and DWARF debugging information.


%prep
%autosetup -n %{srcname}-%{version}

%build
%py2_build
%py3_build

%install
# Must do the python2 install first because the scripts in /usr/bin are
# overwritten with every setup.py install, and in general we want the
# python3 version to be the default.
# If, however, we're installing separate executables for python2 and python3,
# the order needs to be reversed so the unversioned executable is the python2 one.
%py2_install
%py3_install

# Note that there is no %%files section for the unversioned python module if we are building for several python runtimes
%files -n python2-%{srcname}
%license LICENSE
%{python2_sitelib}/*

%files -n python3-%{srcname}
%license LICENSE
%{python3_sitelib}/*
%{_bindir}/readelf.py

%changelog
* Sun Mar 25 2018 Thomas Sailer <t.sailer@alumni.ethz.ch> - 0.24-1
- initial spec file