%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 binstruct
%global global_desc \
The binstruct library allows you to access binary data using a \
predefined structure. The binary data can be provided in any form \
that allows an indexed access to single bytes. This could for example \
be a memory-mapped file. The data structure itself is defined in way \
similar to Django database table definitions by declaring a new class \
with its fields.
Name: python-%{pypi_name}
Version: 1.0.1
Release: 5%{?dist}
Summary: Library for read/write access of binary data via structures
License: GPLv3+
URL: https://pypi.python.org/pypi/%{pypi_name}
Source0: https://files.pythonhosted.org/packages/source/b/%{pypi_name}/%{pypi_name}-%{version}.zip
BuildArch: noarch
BuildRequires: dos2unix
%description
%{global_desc}
%package -n python2-%{pypi_name}
Summary: %{summary}
BuildRequires: python2-devel
BuildRequires: python2-nose
BuildRequires: python2-pytest
BuildRequires: python2-setuptools
%{?python_provide:%python_provide python2-%{pypi_name}}
%description -n python2-%{pypi_name}
%{global_desc}
%if %{with python3}
%package -n python3-%{pypi_name}
Summary: %{summary}
BuildRequires: python3-devel
BuildRequires: python3-nose
BuildRequires: python3-pytest
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}
%{_bindir}/find . -type f -print0 | \
%{_bindir}/xargs -0 --max-args=1 %{_bindir}/dos2unix -ascii -k -s
%build
%py2_build
%if %{with python3}
%py3_build
%endif # with python3
%install
%py2_install
%if %{with python3}
%py3_install
%endif # with python3
%check
%{_bindir}/nosetests-%{python2_version} -vv
%if %{with python3}
%{_bindir}/nosetests-%{python3_version} -vv
%endif
%files -n python2-%{pypi_name}
%license LICENSE.txt
%doc PKG-INFO README.rst
%{python2_sitelib}/%{pypi_name}.py*
%{python2_sitelib}/%{pypi_name}-%{version}-py%{python2_version}.egg-info
%if %{with python3}
%files -n python3-%{pypi_name}
%license LICENSE.txt
%doc PKG-INFO README.rst
%{python3_sitelib}/%{pypi_name}.py
%{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info
%{python3_sitelib}/__pycache__/%{pypi_name}.cpython-%{python3_version_nodots}*.pyc
%endif # with python3
%changelog
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 1.0.1-2
- Rebuild for Python 3.6
* Mon Oct 24 2016 Björn Esser <fedora@besser82.io> - 1.0.1-1
- Initial import (rhbz 1387835)
* Sat Oct 22 2016 Björn Esser <fedora@besser82.io> - 1.0.1-0.1
- Initial package (rhbz 1387835)