Name:           python-h2
Version:        3.1.0
Release:        4
Summary:        A HTTP/2 protocol stack for Python
License:        MIT
URL:            http://hyper.rtfd.org
Source0:        https://files.pythonhosted.org/packages/c9/08/109f814130177273afc06b1f9851084397c337b09cdc6f17172c00f3d02b/h2-3.1.0.tar.gz
BuildArch:      noarch

BuildRequires:  (python2dist(hpack) >= 2.3 with python2dist(hpack) < 4) (python2dist(hyperframe) with python2dist(hyperframe) < 6)
BuildRequires:  python2-devel python2dist(setuptools) python2dist(pytest) python2dist(hypothesis)
BuildRequires:  (python3dist(hpack) >= 2.3 with python3dist(hpack) < 4) (python3dist(hyperframe) with python3dist(hyperframe) < 6)
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 python2-h2
Summary:        A HTTP/2 protocol stack for Python 2
%{?python_provide:%python_provide python2-h2}

%description -n python2-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 -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
%py2_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
%py2_install
%py3_install

%check
%{__python2} -m pytest
%{__python3} -m pytest

%files -n python2-h2
%doc README.rst LICENSE
%{python2_sitelib}/h2
%{python2_sitelib}/h2-%{version}-py?.?.egg-info

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

%files help
%doc html LICENSE

%changelog
* 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
