Blob Blame History Raw
# Created by pyp2rpm-1.0.1
%global pypi_name croniter

%if 0%{?fedora}
%global with_python3 1
%endif

%if 0%{?rhel} && 0%{?rhel} <= 6
%{!?__python2: %global __python2 /usr/bin/python}
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%endif

Name:           python-%{pypi_name}
Version:        0.3.4
Release:        4%{?dist}
Summary:        Iteration for datetime object with cron like format

License:        MIT
URL:            http://github.com/kiorky/croniter
Source0:        https://pypi.python.org/packages/source/c/%{pypi_name}/%{pypi_name}-%{version}.zip
BuildArch:      noarch

BuildRequires:  python2-devel
BuildRequires:  python-setuptools

# For tests
BuildRequires:  python-dateutil
BuildRequires:  pytz

Requires:       python-dateutil

%description
Croniter provides iteration for datetime object with cron like format.

%if 0%{?with_python3}
%package -n python3-%{pypi_name}
Summary:        Iteration for datetime object with cron like format
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  python3-dateutil
BuildRequires:  python3-pytz

Requires:       python3-dateutil

%description -n python3-%{pypi_name}
Croniter provides iteration for datetime object with cron like format.
%endif

%prep
%setup -q -n %{pypi_name}-%{version}
# Remove bundled egg-info
rm -rf %{pypi_name}.egg-info
# Remove reundant script header to avoid rpmlint warnings
find -name \*.py -exec sed -i '/\/usr\/bin\/env python/{d;q}' {} +

%if 0%{?with_python3}
cp -a . %{py3dir}
%endif


%build
%{__python2} setup.py build

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


%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


%check
PYTHONPATH=%{buildroot}%{python2_sitelib}/ %{__python2} -m unittest %{pypi_name}.tests.test_croniter
rm -fr %{buildroot}%{python2_sitelib}/%{pypi_name}/tests/

%if 0%{?with_python3}
PYTHONPATH=%{buildroot}%{python3_sitelib}/ %{__python3} -m unittest discover -s %{buildroot}%{python3_sitelib}/%{pypi_name}/tests -p 'test_*.py'
rm -fr %{buildroot}%{python3_sitelib}/%{pypi_name}/tests/
%endif


%files
%doc README.rst docs/LICENSE
%{python2_sitelib}/%{pypi_name}
%{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info

%if 0%{?with_python3}
%files -n python3-%{pypi_name}
%doc README.rst docs/LICENSE
%{python3_sitelib}/%{pypi_name}
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
%endif


%changelog
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.4-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Wed May 14 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 0.3.4-3
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4

* Fri Feb 21 2014 Pádraig Brady <P@draigBrady.com> - 0.3.4-2
- Initial package.