%if 0%{?fedora} # Upstream is not ready to support python3 yet, so we turn it off. %global with_python3 0 %endif %{!?_licensedir: %global license %%doc} %if 0%{?rhel} && 0%{?rhel} <= 6 %{!?__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))")} %endif %global modname txrequests Name: python-txrequests Version: 0.9.2 Release: 1%{?dist} Summary: Asynchronous Python HTTP for Humans Group: Development/Libraries License: ASL 2.0 URL: http://pypi.python.org/pypi/txrequests Source0: https://pypi.python.org/packages/source/t/%{modname}/%{modname}-%{version}.tar.gz BuildArch: noarch BuildRequires: python2-devel BuildRequires: python-setuptools BuildRequires: python-requests BuildRequires: python-twisted-core %if 0%{?with_python3} BuildRequires: python3-devel BuildRequires: python3-requests BuildRequires: python3-twisted-core %endif Requires: python-requests Requires: python-twisted-core %description This is a small add-on for the python requests HTTP library. It makes use twisted's ThreadPool, so that requests' API returns deferreds. The additional API and changes are minimal and strive to avoid surprises. %if 0%{?with_python3} %package -n python3-txrequests Summary: Asynchronous Python HTTP for Humans. Group: Development/Libraries Requires: python3-requests Requires: python3-twisted-core %description -n python3-txrequests This is a small add-on for the python requests HTTP library. It makes use twisted's ThreadPool, so that requests' API returns deferreds. The additional API and changes are minimal and strive to avoid surprises. %endif %prep %setup -q -n %{modname}-%{version} # Remove bundled egg-info in case it exists rm -rf %{modname}.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 %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py install -O1 --skip-build --root=%{buildroot} popd %endif %{__python2} setup.py install -O1 --skip-build --root=%{buildroot} %check %{__python2} setup.py test %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py test popd %endif %files %doc README.rst %license LICENSE %{python2_sitelib}/%{modname}/ %{python2_sitelib}/%{modname}-%{version}* %if 0%{?with_python3} %files -n python3-txrequests %doc README.rst %license LICENSE %{python3_sitelib}/%{modname}/ %{python3_sitelib}/%{modname}-%{version}* %endif %changelog * Tue Nov 04 2014 Ralph Bean - 0.9.2-1 - Initial package for Fedora