Ricky Elrod c9348bb
# Created by pyp2rpm-1.1.1
Ricky Elrod c9348bb
%global pypi_name requests-cache
Ricky Elrod c9348bb
%global with_python3 1
Ricky Elrod c9348bb
Ricky Elrod c9348bb
Name:           python-%{pypi_name}
Ricky Elrod c9348bb
Version:        0.4.6
Ricky Elrod c9348bb
Release:        2%{?dist}
Ricky Elrod c9348bb
Summary:        Persistent cache for requests library
Ricky Elrod c9348bb
Ricky Elrod c9348bb
License:        BSD
Ricky Elrod c9348bb
URL:            https://github.com/reclosedev/requests-cache
Ricky Elrod c9348bb
Source0:        https://pypi.python.org/packages/source/r/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
Ricky Elrod c9348bb
BuildArch:      noarch
Ricky Elrod c9348bb
Ricky Elrod c9348bb
BuildRequires:  python-devel
Ricky Elrod c9348bb
BuildRequires:  python-requests
Ricky Elrod c9348bb
BuildRequires:  python-sphinx
Ricky Elrod c9348bb
Ricky Elrod c9348bb
%if %{?with_python3}
Ricky Elrod c9348bb
BuildRequires:  python3-devel
Ricky Elrod c9348bb
BuildRequires:  python3-requests
Ricky Elrod c9348bb
BuildRequires:  python3-sphinx
Ricky Elrod c9348bb
%endif # if with_python3
Ricky Elrod c9348bb
Ricky Elrod c9348bb
Requires:       python-requests >= 1.1.0
Ricky Elrod c9348bb
Ricky Elrod c9348bb
%description
Ricky Elrod c9348bb
Requests-cache is a transparent persistent
Ricky Elrod c9348bb
cache for the requests (version >= 1.1.0) library.
Ricky Elrod c9348bb
Ricky Elrod c9348bb
%if 0%{?with_python3}
Ricky Elrod c9348bb
%package -n     python3-%{pypi_name}
Ricky Elrod c9348bb
Summary:        Persistent cache for requests library
Ricky Elrod c9348bb
Ricky Elrod c9348bb
Requires:       python3-requests >= 1.1.0
Ricky Elrod c9348bb
Ricky Elrod c9348bb
%description -n python3-%{pypi_name}
Ricky Elrod c9348bb
Requests-cache is a transparent persistent
Ricky Elrod c9348bb
cache for the requests (version >= 1.1.0) library.
Ricky Elrod c9348bb
%endif # with_python3
Ricky Elrod c9348bb
Ricky Elrod c9348bb
Ricky Elrod c9348bb
%prep
Ricky Elrod c9348bb
%setup -q -n %{pypi_name}-%{version}
Ricky Elrod c9348bb
# Remove bundled egg-info
Ricky Elrod c9348bb
rm -rf %{pypi_name}.egg-info
Ricky Elrod c9348bb
Ricky Elrod c9348bb
# generate html docs
Ricky Elrod c9348bb
sphinx-build docs html
Ricky Elrod c9348bb
# remove the sphinx-build leftovers
Ricky Elrod c9348bb
rm -rf html/.{doctrees,buildinfo}
Ricky Elrod c9348bb
Ricky Elrod c9348bb
%if 0%{?with_python3}
Ricky Elrod c9348bb
rm -rf %{py3dir}
Ricky Elrod c9348bb
cp -a . %{py3dir}
Ricky Elrod c9348bb
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
Ricky Elrod c9348bb
# generate html docs
Ricky Elrod c9348bb
sphinx-build-3 docs html
Ricky Elrod c9348bb
# remove the sphinx-build leftovers
Ricky Elrod c9348bb
rm -rf html/.{doctrees,buildinfo}
Ricky Elrod c9348bb
Ricky Elrod c9348bb
%endif # with_python3
Ricky Elrod c9348bb
Ricky Elrod c9348bb
Ricky Elrod c9348bb
%build
Ricky Elrod c9348bb
%{__python2} setup.py build
Ricky Elrod c9348bb
Ricky Elrod c9348bb
%if 0%{?with_python3}
Ricky Elrod c9348bb
pushd %{py3dir}
Ricky Elrod c9348bb
%{__python3} setup.py build
Ricky Elrod c9348bb
popd
Ricky Elrod c9348bb
%endif # with_python3
Ricky Elrod c9348bb
Ricky Elrod c9348bb
Ricky Elrod c9348bb
%install
Ricky Elrod c9348bb
# Must do the subpackages' install first because the scripts in /usr/bin are
Ricky Elrod c9348bb
# overwritten with every setup.py install (and we want the python2 version
Ricky Elrod c9348bb
# to be the default for now).
Ricky Elrod c9348bb
%if 0%{?with_python3}
Ricky Elrod c9348bb
pushd %{py3dir}
Ricky Elrod c9348bb
%{__python3} setup.py install --skip-build --root %{buildroot}
Ricky Elrod c9348bb
Ricky Elrod c9348bb
# Fix rpmlints:
Ricky Elrod c9348bb
for lib in `find %{buildroot}%{python3_sitelib}/requests_cache -name '*.py' -print`; do
Ricky Elrod c9348bb
 sed '1{\@^#!/usr/bin/env python@d}' $lib > $lib.new &&
Ricky Elrod c9348bb
 touch -r $lib $lib.new &&
Ricky Elrod c9348bb
 mv $lib.new $lib
Ricky Elrod c9348bb
done
Ricky Elrod c9348bb
sed -i '1{\@^#!/usr/bin/python@d}' %{buildroot}%{python3_sitelib}/requests_cache/backends/storage/dbdict.py
Ricky Elrod c9348bb
Ricky Elrod c9348bb
popd
Ricky Elrod c9348bb
%endif # with_python3
Ricky Elrod c9348bb
Ricky Elrod c9348bb
%{__python2} setup.py install --skip-build --root %{buildroot}
Ricky Elrod c9348bb
Ricky Elrod c9348bb
# Fix rpmlints:
Ricky Elrod c9348bb
for lib in `find %{buildroot}%{python2_sitelib}/requests_cache -name '*.py' -print`; do
Ricky Elrod c9348bb
 sed '1{\@^#!/usr/bin/env python@d}' $lib > $lib.new &&
Ricky Elrod c9348bb
 touch -r $lib $lib.new &&
Ricky Elrod c9348bb
 mv $lib.new $lib
Ricky Elrod c9348bb
done
Ricky Elrod c9348bb
sed -i '1{\@^#!/usr/bin/python@d}' %{buildroot}%{python2_sitelib}/requests_cache/backends/storage/dbdict.py
Ricky Elrod c9348bb
sed -i 's/\r$//' html/_static/jquery.js
Ricky Elrod c9348bb
sed -i 's/\r$//' LICENSE
Ricky Elrod c9348bb
Ricky Elrod c9348bb
%files
Ricky Elrod c9348bb
%doc html README.rst LICENSE
Ricky Elrod c9348bb
%{python2_sitelib}/requests_cache
Ricky Elrod c9348bb
%{python2_sitelib}/requests_cache-%{version}*
Ricky Elrod c9348bb
%if 0%{?with_python3}
Ricky Elrod c9348bb
%files -n python3-%{pypi_name}
Ricky Elrod c9348bb
%doc html README.rst LICENSE
Ricky Elrod c9348bb
%{python3_sitelib}/requests_cache
Ricky Elrod c9348bb
%{python3_sitelib}/requests_cache-%{version}*
Ricky Elrod c9348bb
%endif # with_python3
Ricky Elrod c9348bb
Ricky Elrod c9348bb
Ricky Elrod c9348bb
%changelog
Ricky Elrod c9348bb
* Thu Oct 30 2014 Ricky Elrod <relrod@redhat.com> - 0.4.6-2
Ricky Elrod c9348bb
- Fix rpmlint warnings: line endings in docs/license
Ricky Elrod c9348bb
- Fix rpmlint warnings: shebang line in non-scripts
Ricky Elrod c9348bb
Ricky Elrod c9348bb
* Wed Oct 29 2014 Ricky Elrod <relrod@redhat.com> - 0.4.6-1
Ricky Elrod c9348bb
- Initial package.