%global commit 76e9481c1a183048d0a1af0148d9f0cbd3556753
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global project email-reply-parser
%global owner zapier
%global date 20140523
%if 0%{?fedora} > 12
%global with_python3 1
%else
%{!?__python2: %global __python2 /usr/bin/python2}
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
%endif
%global with_tests 0
#Test is failing :(
#Reported to upstream
#See: https://github.com/zapier/email-reply-parser/issues/17
%global pypi_name email_reply_parser
Name: python-%{pypi_name}
Version: 0.3.0
Release: %{date}git%{shortcommit}%{?dist}
Summary: Email reply parser library for Python 2
License: MIT
URL: https://github.com/zapier/email-reply-parser
Source0: https://github.com/%{owner}/%{project}/archive/%{commit}/%{project}-%{commit}.tar.gz
BuildArch: noarch
Group: Development/Libraries
BuildRequires: python2-devel
BuildRequires: python-setuptools
%if 0%{?with_python3}
BuildRequires: python3-setuptools
BuildRequires: python3-devel
BuildRequires: python3
%endif # if with_python3
%description
A port of GitHub's Email Reply Parser library. Email Reply Parser makes it easy
to grab only the last reply to an on-going email thread.
%if 0%{?with_python3}
%package -n python3-%{pypi_name}
Summary: Email reply parser library for Python 3
Group: Development/Libraries
Requires: python3
%description -n python3-%{pypi_name}
Python3 port of GitHub's Email Reply Parser library. Email Reply Parser makes
it easy to grab only the last reply to an on-going email thread.
%endif # if with_python3
%prep
%setup -q -n %{project}-%{commit}
# Remove bundled egg-info
rm -rf %{pypi_name}.egg-info
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif # with_python3
%build
%{__python2} setup.py build
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif # with_python3
%install
%{__python2} setup.py install --skip-build --root %{buildroot}
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root=%{buildroot}
popd
%endif # with_python3
%if 0%{?with_tests}
%check
%{__python2} setup.py test
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py test
popd
%endif # with_python3
%endif # with_test
%files
%doc README.md
%{!?_licensedir:%global license %%doc}
%license LICENSE
%{python2_sitelib}/%{pypi_name}
%{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
%if 0%{?with_python3}
%files -n python3-%{pypi_name}
%{!?_licensedir:%global license %%doc}
%doc README.md
%license LICENSE
%{python3_sitelib}/%{pypi_name}
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
%endif # with_python3
%changelog
* Wed Apr 08 2015 William Moreno Reyes <williamjmorenor at gmail.com>
- 0.3.0-20140523git76e9481
- Define %%license macro for EPEL < 7
* Sun Mar 22 2015 William Moreno Reyes <williamjmorenor at gmail.com>
- 0.3.0-20140523git76e9481.1
- Initial package.