Blob Blame History Raw
# Created by pyp2rpm-1.1.0b
%global pypi_name CacheControl
%global pypi_name_lower cachecontrol
%global with_python3 1

Name:           python-%{pypi_name}
Version:        0.10.1
Release:        1%{?dist}
Summary:        httplib2 caching for requests

License:        MIT
URL:            https://github.com/ionrock/cachecontrol
Source0:        https://pypi.python.org/packages/source/C/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
# to get tests:
# git clone https://github.com/ionrock/cachecontrol.git && cd cachecontrol
# git checkout v0.10.1 && tar -czvf CacheControl-0.10.1-tests.tar.gz tests/ conftest.py
Source1:        %{pypi_name}-%{version}-tests.tar.gz
BuildArch:      noarch

BuildRequires:  python-devel
BuildRequires:  pytest
BuildRequires:  python-lockfile
BuildRequires:  python-mock
BuildRequires:  python-redis
BuildRequires:  python-requests
BuildRequires:  python-webtest

Requires:       python-requests

%description
CacheControl is a port of the caching algorithms in httplib2_ for use with
requests_ session object. It was written because httplib2's better support
for caching is often mitigated by its lack of threadsafety. The same is
true of requests in terms of caching.

%if 0%{?with_python3}
%package -n     python3-%{pypi_name}
Summary:        httplib2 caching for requests

BuildRequires:  python3-devel
BuildRequires:  python3-pytest
BuildRequires:  python3-lockfile
BuildRequires:  python3-mock
BuildRequires:  python3-redis
BuildRequires:  python3-requests
BuildRequires:  python3-webtest

Requires:       python3-requests

%description -n python3-%{pypi_name}
CacheControl is a port of the caching algorithms in httplib2_ for use with
requests_ session object. It was written because httplib2's better support
for caching is often mitigated by its lack of threadsafety. The same is
true of requests in terms of caching.
This is the Python 3 build of CacheControl.
%endif # with_python3


%prep
%setup -q -n %{pypi_name}-%{version}
# 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
# Must do the subpackages' install first because the scripts in /usr/bin are
# overwritten with every setup.py install (and we want the python2 version
# to be the default for now).
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot}
popd
%endif # with_python3

%{__python2} setup.py install --skip-build --root %{buildroot}


%check
tar -xzf %{SOURCE1}
py.test tests

%if 0%{?with_python3}
pushd %{py3dir}
tar -xzf %{SOURCE1}
py.test-%{python3_version}
popd
%endif # with_python3


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

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


%changelog
* Wed Jun 04 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 0.10.1-1
- Initial package.