Blob Blame History Raw
# what it's called on pypi
%global srcname hpack
# what it's imported as
%global libname hpack

%global common_description %{expand:
HTTP/2 Header Encoding for Python This module contains a pure-Python
HTTP/2 header encoding (HPACK) logic for use in Python programs that implement
HTTP/2. It also contains a compatibility layer that automatically enables the
use of nghttp2 if it's available.}

%if %{defined fedora}
%bcond_without docs

%bcond_without  check

Name:           python-%{srcname}
Version:        4.0.0
Release:        1%{?dist}
Summary:        Pure-Python HPACK header compression

License:        MIT
Source0:        %vcs/archive/v%{version}/%{srcname}-%{version}.tar.gz

BuildArch:      noarch
BuildRequires:  make
BuildRequires:  python3-devel

%description %{common_description}

%package -n     python3-%{srcname}
Summary:        %{summary}

%description -n python3-%{srcname} %{common_description}

%package doc
Summary:        Documentation for %{name}

%description doc

This is the documentation package for %{name}.

%autosetup -p1 -n %{srcname}-%{version}

# Upstream uses tox to call pytest.  If we used it we'd have to patch out
# pytest-xdist, pytest-cov, and coverage related pytest flags.  Instead, we'll
# just call pytest directly.
echo 'python3dist(hypothesis)'
echo 'python3dist(pytest)'
echo 'python3dist(sphinx)'


# generate html docs
PYTHONPATH=${PWD} sphinx-build-3 docs/source html
# remove the sphinx-build leftovers
rm -rf html/.{doctrees,buildinfo}

%pyproject_save_files %{libname}

%if %{with check}
%pytest -k 'not test_get_by_index_out_of_range'

%files -n python3-%{srcname} -f %{pyproject_files}
%license LICENSE
%doc README.rst

%files doc
%doc html
%license LICENSE