%if 0%{?fedora} %global with_python3 1 %endif %{!?__python2: %global __python2 /usr/bin/python2} %{!?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))")} %{!?_licensedir:%global license %%doc} Name: python-requests-mock Version: 0.7.0 Release: 1%{?dist} Summary: A requests mocking tool for python License: ASL 2.0 URL: http://requests-mock.readthedocs.org/ Source0: https://pypi.python.org/packages/source/r/requests-mock/requests-mock-%{version}.tar.gz # Remove additional build dependencies that aren't required for the package Patch0: 0001-Remove-test-dependencies.patch Patch1: 0002-Use-system-urllib3-package.patch BuildArch: noarch %description requests-mock provides a simple way to do HTTP mocking at the python-requests layer. %package -n python2-requests-mock Summary: A requests mocking tool for python Requires: python-requests Requires: python-six # urllib3 required because requests packaging uses it and our patch uses it Requires: python-urllib3 # standard requirements needed for testing BuildRequires: python-requests BuildRequires: python-six BuildRequires: python-urllib3 BuildRequires: python2-devel BuildRequires: python-fixtures BuildRequires: python-mock BuildRequires: python-pbr BuildRequires: python-setuptools BuildRequires: python-testtools %if 0%{?rhel} && 0%{?rhel} <= 6 BuildRequires: python-discover %endif %{?python_provide:%python_provide python2-requests-mock} %description -n python2-requests-mock requests-mock provides a simple way to do HTTP mocking at the python-requests layer. %if 0%{?with_python3} %package -n python3-requests-mock Summary: A requests mocking tool for python Requires: python3-requests Requires: python3-six # urllib3 required because requests packaging uses it and our patch uses it Requires: python3-urllib3 # standard requirements needed for testing BuildRequires: python3-requests BuildRequires: python3-six BuildRequires: python3-urllib3 BuildRequires: python3-devel BuildRequires: python3-fixtures BuildRequires: python3-mock BuildRequires: python3-pbr BuildRequires: python3-setuptools BuildRequires: python3-testtools %{?python_provide:%python_provide python3-requests-mock} %description -n python3-requests-mock requests-mock provides a simple way to do HTTP mocking at the python-requests layer. %endif %prep %setup -q -n requests-mock-%{version} %patch0 -p1 %patch1 -p1 # Remove bundled egg-info rm -rf requests_mock.egg-info %if 0%{?with_python3} rm -rf %{py3dir} cp -a . %{py3dir} %endif %build %py2_build %if 0%{?with_python3} pushd %{py3dir} %py3_build popd %endif %install rm -rf $RPM_BUILD_ROOT %py2_install %if 0%{?with_python3} pushd %{py3dir} %py3_install popd %endif %check %{__python2} -m testtools.run discover %if 0%{?with_python3} pushd %{py3dir} %{__python3} -m testtools.run discover popd %endif %files %license LICENSE %doc README.rst ChangeLog %{python_sitelib}/requests_mock %{python_sitelib}/requests_mock-%{version}-py2.?.egg-info %if 0%{?with_python3} %files -n python3-requests-mock %license LICENSE %doc README.rst ChangeLog %{python3_sitelib}/requests_mock %{python3_sitelib}/requests_mock-%{version}-py3.?.egg-info %endif %changelog * Fri Dec 4 2015 Jamie Lennox - 0.7.0-1 - Update package to new version. - Add python2 subpackage for new python packaging guidelines. - Redo patch1 to still apply. * Tue Nov 10 2015 Fedora Release Engineering - 0.6.0-3 - Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5 * Thu Jun 18 2015 Fedora Release Engineering - 0.6.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild * Fri Feb 6 2015 Jamie Lennox - 0.6.0-1 - Update package to new version * Tue Sep 2 2014 Jamie Lennox - 0.5.1-2 - Removed packaged egg-info to force rebuild. - Removed unneeded CFLAGS from build commands. * Thu Aug 28 2014 Jamie Lennox - 0.5.1-1 - Initial Package.