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.
This commit is contained in:
parent
2e8183c723
commit
aa1b17497b
@ -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@redhat.com> - 0.8.3-2
|
||||
- Added with_python3 build flags to enable building on EPEL.
|
||||
|
||||
* Mon Jul 28 2014 Jamie Lennox <jamielennox@redhat.com> - 0.8.3-1
|
||||
- Updated to new version.
|
||||
- Removed check, there are simply too many problems upstream.
|
||||
|
Loading…
Reference in New Issue
Block a user