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

%global modname arrow

Name:               python-%{modname}
Version:            0.4.2
Release:            2%{?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
BuildRequires:      python-chai
BuildRequires:      python-dateutil
BuildRequires:      python-six
Requires:           python-dateutil
Requires:           python-six

%if 0%{?with_python3}
BuildRequires:      python3-devel
BuildRequires:      python3-chai
BuildRequires:      python3-dateutil
BuildRequires:      python3-six
Requires:           python3-dateutil
Requires:            python3-six
%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}

%check
## Disable the tests as apparently the version 0.4.2 does not ship them

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


%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
* Tue Dec 17 2013 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.4.2-1
- Add python-six and python-dateutil as Requires

* Wed Nov 27 2013 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.4.2-1
- Update to 0.4.2
- Prepare for when the tests will be included in the releases
- Add BR to python-chai, python-dateutil and python-six

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