File python-treq.spec of Package python-treq
%global pypi_name treq
%global with_doc 1
Name: python-%{pypi_name}
Version: 24.9.1
Release: 3%{?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
%if 0%{?with_doc}
BuildRequires: python3-twisted
BuildRequires: python3-sphinx
%endif
BuildRequires: python3-devel
# For tests
BuildRequires: python3-pytest
BuildRequires: python3-httpbin
%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 python3-%{pypi_name}
Summary: %{summary}
%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.
%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}
%generate_buildrequires
%pyproject_buildrequires
%build
%pyproject_wheel
%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
%pyproject_install
%pyproject_save_files treq
%check
%pytest -v
%files -n python3-%{pypi_name} -f %{pyproject_files}
%doc README.rst
%if 0%{?with_doc}
%files -n python-%{pypi_name}-doc
%license LICENSE
%doc html
%endif