%if 0%{?fedora} || 0%{?rhel} >= 8
%bcond_without python3
%else # 0#{?fedora} || 0#{?rhel} >= 8
%bcond_with python3
%endif # 0#{?fedora} || 0#{?rhel} >= 8
%global pypi_name bz2file
%global global_sum Read and write bzip2-compressed files
%global global_desc \
%{pypi_name} is a Python library for reading and writing \
bzip2-compressed files. \
\
It contains a drop-in replacement for the file interface in the \
standard library’s bz2 module, including features from the latest \
development version of CPython that are not available in older releases.
Name: python-%{pypi_name}
Version: 0.98
Release: 1%{?dist}
Summary: %{global_sum}
License: ASL 2.0
URL: https://pypi.python.org/pypi/%{pypi_name}
Source0: https://files.pythonhosted.org/packages/source/b/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
BuildArch: noarch
%description
%{global_desc}
%package -n python2-%{pypi_name}
Summary: %{global_sum}
BuildRequires: python2-devel
BuildRequires: python-setuptools
%{?python_provide:%python_provide python2-%{pypi_name}}
%description -n python2-%{pypi_name}
%{global_desc}
%if %{with python3}
%package -n python3-%{pypi_name}
Summary: %{global_sum}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
%{?python_provide:%python_provide python3-%{pypi_name}}
%description -n python3-%{pypi_name}
%{global_desc}
%endif # with python3
%prep
%autosetup -n %{pypi_name}-%{version}
%{__rm} -fr *.egg*
%build
%py2_build
%if %{with python3}
%py3_build
%endif # with python3
%install
%py2_install
%if %{with python3}
%py3_install
%endif # with python3
%check
%{__python2} test_bz2file.py
%if %{with python3}
%{__python3} test_bz2file.py
%endif # with python3
%files -n python2-%{pypi_name}
%doc PKG-INFO
%{python2_sitelib}/%{pypi_name}.py
%{python2_sitelib}/%{pypi_name}.py?
%{python2_sitelib}/%{pypi_name}-%{version}-py%{python2_version}.egg-info
%if %{with python3}
%files -n python3-%{pypi_name}
%doc PKG-INFO
%{python3_sitelib}/__pycache__/%{pypi_name}.cpython-%{python3_version_nodots}*.py?
%{python3_sitelib}/%{pypi_name}.py
%{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info
%endif # with python3
%changelog
* Wed Apr 26 2017 Björn Esser <besser82@fedoraproject.org> - 0.98-1
- Initial rpm-release (rhbz#1442743)
* Mon Apr 17 2017 Björn Esser <besser82@fedoraproject.org> - 0.98-0.1
- Initial rpm-release (rhbz#1442743)