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.12.3
Release:        4%{?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.12.3 && tar -czvf CacheControl-0.12.3-tests.tar.gz tests/
Source1:        %{pypi_name}-%{version}-tests.tar.gz
BuildArch:      noarch

BuildRequires:  python2-cherrypy
BuildRequires:  python2-devel
BuildRequires:  python2-pytest
BuildRequires:  python2-lockfile
BuildRequires:  python2-mock
BuildRequires:  python2-msgpack
BuildRequires:  python2-redis
BuildRequires:  python2-requests

%global _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.

%description %_description

%package -n python2-cachecontrol
Summary: %summary
Requires:       python2-msgpack
Requires:       python2-requests
%{?python_provide:%python_provide python2-cachecontrol}

%description -n python2-cachecontrol %_description

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

BuildRequires:  python3-cherrypy
BuildRequires:  python3-devel
BuildRequires:  python3-pytest
BuildRequires:  python3-lockfile
BuildRequires:  python3-mock
BuildRequires:  python3-msgpack
BuildRequires:  python3-redis
BuildRequires:  python3-requests

Requires:       python3-msgpack
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
%{__python2} setup.py install --skip-build --root %{buildroot}
%if 0%{?with_python3}
# Delete the Python 2 executable(s) so that the Python 3
# version(s) can take their place afterwards.
rm -rf %{buildroot}%{_bindir}/*
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot}
popd
%endif # with_python3


%check
tar -xzf %{SOURCE1}
touch tests/__init__.py
# skip a test requiring internet access
py.test tests -k "not test_file_cache_recognizes_consumed_file_handle"

%if 0%{?with_python3}
pushd %{py3dir}
tar -xzf %{SOURCE1}
touch tests/__init__.py
py.test-%{python3_version} tests -k "not test_file_cache_recognizes_consumed_file_handle"
popd
%endif # with_python3


%files -n python2-cachecontrol
%doc README.rst
%{python2_sitelib}/%{pypi_name_lower}
%{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
%if 0%{!?with_python3}
%{_bindir}/doesitcache
%endif

%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
%{_bindir}/doesitcache
%endif # with_python3


%changelog
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.12.3-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Mon Jan 15 2018 Iryna Shcherbina <ishcherb@redhat.com> - 0.12.3-3
- Update Python 2 dependency declarations to new packaging standards
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)

* Wed Sep 13 2017 Iryna Shcherbina <ishcherb@redhat.com> - 0.10.0-2
- Fix Python 2 dependency from python3-CacheControl (rhbz#1490893)

* Wed Aug 23 2017 Tomas Krizek <tkrizek@redhat.com> - 0.12.3-1
- Update to 0.12.3

* Sat Aug 19 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 0.11.5-8
- Python 2 binary package renamed to python2-cachecontrol
  See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.11.5-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.11.5-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 0.11.5-5
- Rebuild for Python 3.6

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.11.5-4
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.11.5-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.11.5-2
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Fri Jun 19 2015 Slavek Kabrda <bkabrda@redhat.com> - 0.11.5-1
- Update to 0.11.5

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.10.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

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