%if 0%{?fedora} > 12 || 0%{?rhel} > 6
%global with_python3 1
%endif

%global modname arrow

Name:               python-%{modname}
Version:            0.4.1
Release:            1%{?dist}
Summary:            Better dates and times for Python

Group:              Development/Libraries
License:            ASL 2.0
URL:                http://pypi.python.org/pypi/arrow
Source0:            http://pypi.python.org/packages/source/a/%{modname}/%{modname}-%{version}.tar.gz

BuildArch:          noarch
BuildRequires:      python2-devel

%if 0%{?with_python3}
BuildRequires:      python3-devel
%endif

%description
Arrow is a Python library that offers a sensible, human-friendly approach to
creating, manipulating, formatting and converting dates, times, and timestamps.
It implements and updates the datetime type, plugging gaps in functionality,
and provides an intelligent module API that supports many common creation
scenarios.
Simply put, it helps you work with dates and times with fewer imports and a lot
less code.


%if 0%{?with_python3}
%package -n         python3-%{modname}
Summary:            Better dates and times for Python
Group:              Development/Libraries

%description -n python3-arrow
Arrow is a Python library that offers a sensible, human-friendly approach to
creating, manipulating, formatting and converting dates, times, and timestamps.
It implements and updates the datetime type, plugging gaps in functionality,
and provides an intelligent module API that supports many common creation
scenarios.
Simply put, it helps you work with dates and times with fewer imports and a lot
less code.
%endif

%prep
%setup -q -n %{modname}-%{version}

# Remove bundled egg-info in case it exists
rm -rf %{modname}.egg-info
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif

%build
%{__python} setup.py build
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif


%install
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root=%{buildroot}
popd
%endif
%{__python} setup.py install -O1 --skip-build --root=%{buildroot}

%files
# pr pending https://github.com/crsmithdev/arrow/pull/70
#%doc LICENSE README.md HISTORY.md
%{python_sitelib}/%{modname}/
%{python_sitelib}/%{modname}-%{version}*

%if 0%{?with_python3}
%files -n python3-%{modname}
#%doc LICENSE README.md HISTORY.md
%{python3_sitelib}/%{modname}/
%{python3_sitelib}/%{modname}-%{version}-*

%endif

%changelog
* Mon Oct 28 2013  Pierre-Yves Chibon <pingou@pingoured.fr> 0.4.1-1
- initial package for Fedora