[python-httpretty] Add with_python3 guards
Jamie Lennox
jamielennox at fedoraproject.org
Wed Feb 25 00:04:18 UTC 2015
commit aa1b17497b9ac528bb4d182e72ad45b3898b2e80
Author: Jamie Lennox <jamielennox at redhat.com>
Date: Wed Feb 25 11:01:39 2015 +1100
Add with_python3 guards
It's been requested to build against epel7 which does not have python3.
I'd prefer to deal with the if statements than have different specs
between fedora and EPEL.
python-httpretty.spec | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
---
diff --git a/python-httpretty.spec b/python-httpretty.spec
index 88d2f7b..2e6cf1a 100644
--- a/python-httpretty.spec
+++ b/python-httpretty.spec
@@ -1,8 +1,13 @@
+%if 0%{?fedora}
+# escaping for EPEL.
+%global with_python3 0
+%endif
+
%global run_tests 0
Name: python-httpretty
Version: 0.8.3
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: HTTP request mock tool for Python
License: MIT
@@ -32,6 +37,7 @@ what if the API server is down? What if its content has changed?
Don't worry, HTTPretty is here for you.
+%if 0%{?with_python3}
%package -n python3-httpretty
Summary: HTTP request mock tool for Python 3
Requires: python3-urllib3
@@ -45,29 +51,36 @@ fine but until the day he needed to test the code that hits the RESTful API:
what if the API server is down? What if its content has changed?
Don't worry, HTTPretty is here for you.
+%endif
%prep
%setup -q -n httpretty-%{version}
%patch0 -p1
%patch1 -p1
+%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
+%endif
%build
CFLAGS="$RPM_OPT_FLAGS" %{__python2} setup.py build
+%if 0%{?with_python3}
pushd %{py3dir}
CFLAGS="$RPM_OPT_FLAGS" %{__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
@@ -77,10 +90,12 @@ popd
%if %{run_tests}
%{__python2} setup.py test
+%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py test
popd
%endif
+%endif
%files
@@ -88,13 +103,18 @@ popd
%{python_sitelib}/httpretty
%{python_sitelib}/httpretty-%{version}-py2.?.egg-info
+%if 0%{?with_python3}
%files -n python3-httpretty
%doc COPYING README.md
%{python3_sitelib}/httpretty
%{python3_sitelib}/httpretty-%{version}-py3.?.egg-info
+%endif
%changelog
+* Tue Feb 24 2015 Jamie Lennox <jamielennox at redhat.com> - 0.8.3-2
+- Added with_python3 build flags to enable building on EPEL.
+
* Mon Jul 28 2014 Jamie Lennox <jamielennox at redhat.com> - 0.8.3-1
- Updated to new version.
- Removed check, there are simply too many problems upstream.
More information about the scm-commits
mailing list