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