[python-requests-mock] Prepare for epel7.

Alan Pevec apevec at fedoraproject.org
Sat Feb 28 09:55:43 UTC 2015


commit a795d5810f853a395ebc6d4ab0f8877d86d6c0a6
Author: Alan Pevec <alan.pevec at redhat.com>
Date:   Wed Feb 25 23:26:20 2015 +0100

    Prepare for epel7.
    
    EL7 does not have python3

 python-requests-mock.spec | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/python-requests-mock.spec b/python-requests-mock.spec
index 4f98abf..cffeee9 100644
--- a/python-requests-mock.spec
+++ b/python-requests-mock.spec
@@ -1,3 +1,7 @@
+%if 0%{?fedora}
+%global with_python3 1
+%endif
+
 Name:           python-requests-mock
 Version:        0.6.0
 Release:        1%{?dist}
@@ -37,6 +41,7 @@ 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
 
@@ -46,10 +51,6 @@ Requires:       python3-six
 # urllib3 required because requests packaging uses it and our patch uses it
 Requires:       python3-urllib3
 
-BuildRequires:  python-requests
-BuildRequires:  python-six
-BuildRequires:  python-urllib3
-
 # standard requirements needed for testing
 BuildRequires:  python3-requests
 BuildRequires:  python3-six
@@ -66,6 +67,7 @@ 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
@@ -76,33 +78,41 @@ python-requests layer.
 # 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
@@ -111,10 +121,12 @@ popd
 %{python_sitelib}/requests_mock-%{version}-py2.?.egg-info
 
 
+%if 0%{?with_python3}
 %files -n python3-requests-mock
 %doc LICENSE README.rst ChangeLog
 %{python3_sitelib}/requests_mock
 %{python3_sitelib}/requests_mock-%{version}-py3.?.egg-info
+%endif
 
 
 %changelog


More information about the scm-commits mailing list