Blob Blame History Raw
%global pkgname sievelib
%global with_python3 1

Name:           python-%{pkgname}
Version:        0.9.2
Release:        4%{?dist}
Summary:        Client-side SIEVE library

Group:          Development/Languages
License:        MIT
URL:            https://github.com/tonioo/sievelib
Source:         https://github.com/tonioo/%{pkgname}/archive/%{version}.tar.gz

BuildArch:      noarch
BuildRequires:  python2-devel 
BuildRequires:  python-setuptools
%if 0%{?with_python3}
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  python3-nose
BuildRequires:  python3-six
BuildRequires:  python3-future
%endif

%description
Client-side Sieve and Managesieve library written in Python.
* Sieve : An Email Filtering Language (RFC 5228)
* ManageSieve : A Protocol for Remotely Managing Sieve Scripts (RFC 5804)

%package -n python2-%{pkgname}
Summary:        Client-side SIEVE library
Group:          Development/Languages
%{?python_provide:%python_provide python2-%{pkgname}}

%description -n python2-%{pkgname}
Client-side Sieve and Managesieve library written in Python.
* Sieve : An Email Filtering Language (RFC 5228)
* ManageSieve : A Protocol for Remotely Managing Sieve Scripts (RFC 5804)

%if 0%{?with_python3}
%package -n python3-%{pkgname}
Summary:        Client-side SIEVE library
Group:          Development/Languages
%{?python_provide:%python_provide python3-%{pkgname}}

%description -n python3-%{pkgname}
Client-side Sieve and Managesieve library written in Python.
* Sieve : An Email Filtering Language (RFC 5228)
* ManageSieve : A Protocol for Remotely Managing Sieve Scripts (RFC 5804)
%endif

%prep
%autosetup -n %{pkgname}-%{version}
# remove bundled egg-info
rm -rf %{pkgname}.egg-info
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif

%build
%py2_build
%if 0%{?with_python3}
pushd %{py3dir}
%py3_build
popd
%endif

%install
%py2_install
# Remove shebang from libraries
for lib in %{buildroot}%{python2_sitelib}/%{pkgname}/*.py; do
 sed '1{\@^#!/usr/bin/env python@d}' $lib > $lib.new &&
 touch -r $lib $lib.new &&
 mv $lib.new $lib
done
%if 0%{?with_python3}
pushd %{py3dir}
%py3_install
# Remove shebang from libraries
for lib in %{buildroot}%{python3_sitelib}/%{pkgname}/*.py; do
 sed '1{\@^#!/usr/bin/env python@d}' $lib > $lib.new &&
 touch -r $lib $lib.new &&
 mv $lib.new $lib
done
%endif

%check
%if 0%{?with_python3}
pushd %{py3dir}
nosetests-%{python3_version}
popd
%endif

%files -n python2-%{pkgname}
%doc README.rst
%license COPYING
%{python2_sitelib}/%{pkgname}
%{python2_sitelib}/%{pkgname}-%{version}-py*.egg-info

%if 0%{?with_python3}
%files -n python3-%{pkgname}
%doc README.rst
%license COPYING
%{python3_sitelib}/%{pkgname}
%{python3_sitelib}/%{pkgname}-%{version}-py*.egg-info
%endif

%changelog
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Mon Nov 16 2015 Juan Orti Alcaine <jorti@fedoraproject.org> - 0.9.2-3
- Use python_provide macro

* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.2-2
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Wed Oct 21 2015 Juan Orti Alcaine <jorti@fedoraproject.org> - 0.9.2-1
- New version 0.9.2

* Mon Jun 29 2015 Juan Orti Alcaine <jorti@fedoraproject.org> - 0.8-5.20150629gite34fb54
- Add python3 subpackage

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.8-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Thu Apr 09 2015 Juan Orti Alcaine <jorti@fedoraproject.org> - 0.8-3
- Use license macro

* Wed Dec 03 2014 Juan Orti <jorti@fedoraproject.org> - 0.8-2
- Remove python shebang from libraries
- Change URL to GitHub
- Include license file

* Tue Dec 02 2014 Juan Orti <jorti@fedoraproject.org> - 0.8-1
- Spec file cleanup

* Sat May 24 2014 Didier Fabert <didier.fabert@gmail.com> 0.0.4-1
- Initial RPM release