Blob Blame History Raw
%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.6.0
Release:        2%{?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

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


%description
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


%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
%{__python2} setup.py build

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif


%install
rm -rf $RPM_BUILD_ROOT
%{__python2} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
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
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Fri Feb 6 2015 Jamie Lennox <jamielennox@redhat.com> - 0.6.0-1
- Update package to new version

* Tue Sep 2 2014 Jamie Lennox <jamielennox@redhat.com> - 0.5.1-2
- Removed packaged egg-info to force rebuild.
- Removed unneeded CFLAGS from build commands.

* Thu Aug 28 2014 Jamie Lennox <jamielennox@redhat.com> - 0.5.1-1
- Initial Package.