%global pypi_name treq
%if 0%{?fedora}
%global with_python3 1
%endif
%global with_doc 1
Name: python-%{pypi_name}
Version: 17.8.0
Release: 2%{?dist}
Summary: A requests-like API built on top of twisted.web's Agent
License: MIT
URL: https://github.com/twisted/treq
Source0: https://files.pythonhosted.org/packages/source/t/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
BuildArch: noarch
BuildRequires: python2-devel
BuildRequires: python2-setuptools
BuildRequires: python2-incremental
%if 0%{?with_doc}
BuildRequires: python2-sphinx
BuildRequires: python2-twisted
%endif
%if 0%{?with_python3}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-incremental
%endif
%description
treq is an HTTP library inspired by requests but written on top of
Twisted’s Agents.
It provides a simple, higher level API for making HTTP requests
when using Twisted.
%package -n python2-%{pypi_name}
Summary: %{summary}
%{?python_provide:%python_provide python2-%{pypi_name}}
Requires: python2-incremental
Requires: python2-requests >= 2.1.0
Requires: python2-six
Requires: python2-twisted >= 16.3.0
Requires: python2-attrs
%description -n python2-%{pypi_name}
treq is an HTTP library inspired by requests but written on top of
Twisted’s Agents.
It provides a simple, higher level API for making HTTP requests
when using Twisted.
%if 0%{?with_python3}
%package -n python3-%{pypi_name}
Summary: %{summary}
%{?python_provide:%python_provide python3-%{pypi_name}}
Requires: python3-incremental
Requires: python3-requests >= 2.1.0
Requires: python3-six
Requires: python3-twisted >= 16.3.0
Requires: python3-attrs
%description -n python3-%{pypi_name}
treq is an HTTP library inspired by requests but written on top of
Twisted’s Agents.
It provides a simple, higher level API for making HTTP requests
when using Twisted.
%endif
%if 0%{?with_doc}
%package -n python-%{pypi_name}-doc
Summary: treq documentation
%description -n python-%{pypi_name}-doc
Documentation for treq
%endif
%prep
%autosetup -n %{pypi_name}-%{version}
# Remove bundled egg-info
rm -rf %{pypi_name}.egg-info
%build
%py2_build
%if 0%{?with_python3}
%py3_build
%endif
%if 0%{?with_doc}
# generate html docs
export PYTHONPATH=%{python2_sitelib}:%{python3_sitelib}:src
sphinx-build docs html
# remove the sphinx-build leftovers
rm -rf html/.{doctrees,buildinfo}
%endif
%install
%if 0%{?with_python3}
%py3_install
%endif
%py2_install
%files -n python2-%{pypi_name}
%license LICENSE
%doc README.rst
%{python2_sitelib}/%{pypi_name}
%{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
%if 0%{?with_python3}
%files -n python3-%{pypi_name}
%license LICENSE
%doc README.rst
%{python3_sitelib}/%{pypi_name}
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
%endif
%if 0%{?with_doc}
%files -n python-%{pypi_name}-doc
%license LICENSE
%doc html
%endif
%changelog
* Wed Aug 30 2017 Yatin Karel <ykarel@redhat.com> - 17.8.0-2
- Enabled Doc build, Fix BR Issues and some nit picks
* Fri Aug 11 2017 ykarel <ykarel@redhat.com> - 17.8.0-1
- Initial package.