Name:           python-h2
Version:        4.1.0
Release:        2
Summary:        A HTTP/2 protocol stack for Python
License:        MIT
URL:            https://python-hyper.org/projects/hyper-h2/en/v4.1.0/
Source0:        https://files.pythonhosted.org/packages/2a/32/fec683ddd10629ea4ea46d206752a95a2d8a48c22521edd70b142488efe1/h2-4.1.0.tar.gz
Patch0:         Fix-repr-checks-for-Python-3.11.patch
BuildArch:      noarch

BuildRequires:  (python3dist(hpack) >= 4 with python3dist(hpack) < 5)
BuildRequires:  (python3dist(hyperframe) >= 6 with python3dist(hyperframe) < 7)
BuildRequires:  python3-devel python3dist(setuptools) python3dist(sphinx) python3dist(pytest) python3dist(hypothesis)
BuildRequires:  js-jquery js-underscore

%{?python_enable_dependency_generator}

%description
This repository contains a pure-Python implementation of a HTTP/2
protocol stack. It is written from the ground up to be embeddable in
whatever program you choose to use, ensuring that you can speak HTTP/2
regardless of your programming paradigm.

%package -n python3-h2
Summary:        A HTTP/2 protocol stack for Python 3
%{?python_provide:%python_provide python3-h2}

%description -n python3-h2
This repository contains a pure-Python implementation of a HTTP/2
protocol stack. It is written from the ground up to be embeddable in
whatever program you choose to use, ensuring that you can speak HTTP/2
regardless of your programming paradigm.

%package help
Summary:        Documents for python-h2

Requires:       js-jquery js-underscore

Provides:       python-h2-doc = %{version}-%{release}
Obsoletes:      python-h2-doc < %{version}-%{release}

%description help
The python-h2-help package contains related documents.

%prep
%autosetup -n h2-%{version} -p1
rm -rf h2.egg-info

%build
%py3_build

PYTHONPATH=${PWD} sphinx-build-3 docs/source html
rm -rf html/{.doctrees,.buildinfo}
rm -f html/_static/{underscore.js,underscore-1.3.1.js,jquery.js,jquery-3.2.1.js}
ln -s /usr/share/javascript/underscore/underscore-min.js html/_static/underscore.js
ln -s /usr/share/javascript/underscore/underscore.js html/_static/underscore-1.3.1.js
ln -s /usr/share/javascript/jquery/3.2.1/jquery.min.js html/_static/jquery.js
ln -s /usr/share/javascript/jquery/3.2.1/jquery.js html/_static/jquery-3.2.1.js

%install
%py3_install

%check
PYTHONPATH=%{buildroot}%{python3_sitelib}  %{__python3} -m pytest

%files -n python3-h2
%doc README.rst LICENSE
%{python3_sitelib}/h2
%{python3_sitelib}/h2-%{version}-py%{python3_version}.egg-info

%files help
%doc html LICENSE

%changelog
* Sun Jul 23 2023 wangkai <13474090681@163.com> - 4.1.0-2
- Fix repr checks for Python 3.11

* Thu Dec 01 2022 dingdingaaaaa <dingziwei@kylinos.cn> - 4.1.0-1
- upgrade version to 4.1.0

* Thu Jul 7 2022 wulei <wulei80@h-partners.com> - 4.0.0-3
- fix with hypothesis 6.6

* Fri May 06 2022 yangping <yangping69@h-partners.com> - 4.0.0-2
- Fix build error caused by py3.10+ wildcard 

* Wed Jul 28 2021 liyanan <liyanan32@huawei.com> - 4.0.0-1
- update to 4.0.0

* Mon Oct 26 2020 maminjie <maminjie1@huawei.com> - 3.1.0-5
- Drop python2 support

* Tue Mar 17 2020 yanglijin <yanglijin@huawei.com> - 3.1.0-4
- modify buildrequires

* Tue Mar 03 2020 Jiangping Hu <hujp1985@foxmail.com> - 3.1.0-3
- Package init
