%{!?python3_pkgversion:%global python3_pkgversion 3}
# EL7 does not have a new enough python-setuptools
%if 0%{?rhel} && 0%{?rhel} <= 7
%global with_python2 0
%else
%global with_python2 1
%endif
%global pypi_name tinydb
%global sum TinyDB is a tiny, document oriented database
%global author msiemens
Name: python-%{pypi_name}
Version: 3.2.1
Release: 2%{?dist}
Summary: %{sum}
License: MIT
URL: https://pypi.python.org/pypi/%{pypi_name}
Source0: https://github.com/%{author}/%{pypi_name}/archive/v%version.tar.gz
BuildArch: noarch
%if 0%{?with_python2}
BuildRequires: python2-devel
BuildRequires: pytest
%endif
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-pytest
%description
TinyDB is a lightweight document oriented database optimized for your happiness
%if 0%{?with_python2}
%package -n python2-%{pypi_name}
Summary: %{sum}
%{?python_provide:%python_provide python2-%{pypi_name}}
%description -n python2-%{pypi_name}
TinyDB is a lightweight document oriented database optimized for your happiness
%endif
%package -n python%{python3_pkgversion}-%{pypi_name}
Summary: %{sum}
%{?python_provide:%python_provide python%{python3_pkgversion}-%{pypi_name}}
%description -n python%{python3_pkgversion}-%{pypi_name}
TinyDB is a lightweight document oriented database optimized for your happiness
%prep
%setup -q -n %{pypi_name}-%{version}
%build
%if 0%{?with_python2}
%py2_build
%endif
%py3_build
%install
%if 0%{?with_python2}
%py2_install
rm -fr %{buildroot}%{python2_sitelib}/tests
%endif
%py3_install
rm -fr %{buildroot}%{python3_sitelib}/tests
%check
%if 0%{?with_python2}
%{__python2} setup.py test
%endif
%{__python3} setup.py test
%if 0%{?with_python2}
%files -n python2-%{pypi_name}
%doc CONTRIBUTING.rst README.rst docs
%license LICENCE
%{python2_sitelib}/%{pypi_name}
%{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
%endif
%files -n python%{python3_pkgversion}-%{pypi_name}
%doc CONTRIBUTING.rst README.rst docs
%license LICENCE
%{python3_sitelib}/%{pypi_name}
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
%changelog
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.2.1-2
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
* Tue Jul 05 2016 Sundeep Anand <suanand@redhat.com> - 3.2.1-1
- Update to latest version
* Mon Jun 20 2016 Sundeep Anand <suanand@redhat.com> - 3.2.0-1
- Update to latest version
* Wed Feb 10 2016 Sundeep Anand <suanand@redhat.com> - 3.1.2-3
- EPEL specific changes
* Tue Feb 09 2016 Sundeep Anand <suanand@redhat.com> - 3.1.2-2
- Include docs directory.
* Tue Feb 02 2016 Sundeep Anand <suanand@redhat.com> - 3.1.2-1
- Initial RPM Package.