Blob Blame History Raw
# Created by pyp2rpm-3.3.2
%global pypi_name h2
%global JQUERY_VERSION %(rpm -q js-jquery --queryformat '%%{version}')

%global common_description %{expand:
HTTP/2 Protocol Stack This repository contains a pure-Python
implementation of a HTTP/2 protocol stack. It's 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.}

%bcond_without docs

Name:           python-%{pypi_name}
Version:        4.1.0
Release:        %autorelease
Summary:        HTTP/2 State-Machine based protocol implementation

License:        MIT
Source0:        %pypi_source

BuildArch:      noarch

BuildRequires:  python3-devel


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

%description -n python3-%{pypi_name}

%if %{with docs}
%package doc
Summary:        Documentation for %{name}

Requires: js-jquery
Requires: js-underscore

%description doc

This is the documentation package for h2.

%autosetup -p1 -n %{pypi_name}-%{version}
# Remove bundled egg-info
rm -rf %{pypi_name}.egg-info
# Relax pytest-cov dependency
sed -i "s|pytest-cov>=2.10.1,<3|pytest-cov>=2.10.1,<4|" tox.ini

%pyproject_buildrequires -t -e docs

%if %{with docs}
# Unbundle
echo 'js-jquery'
echo 'js-underscore'
echo 'make'


%if %{with docs}
# generate html docs
PYTHONPATH=%{buildroot}%{python3_sitelib} sphinx-build-3 docs/source html
# remove the sphinx-build leftovers
rm -rf html/.{doctrees,buildinfo}


# Unbundle JS
rm -v html/_static/underscore.js
ln -s %{datadir}/javascript/underscore/underscore-min.js html/_static/underscore.js
rm -v html/_static/underscore-%{SPHINX_UNDERSCORE_VERSION}.js
ln -s %{datadir}/javascript/underscore/underscore.js html/_static/underscore-%{SPHINX_UNDERSCORE_VERSION}.js
rm -v html/_static/jquery.js
ln -s %{datadir}/javascript/jquery/%{JQUERY_VERSION}/jquery.min.js html/_static/jquery.js
rm -v html/_static/jquery-%{SPHINX_JQUERY_VERSION}.js
ln -s %{datadir}javascript/jquery/%{JQUERY_VERSION}/jquery.js html/_static/jquery-%{SPHINX_JQUERY_VERSION}.js

%pyproject_save_files %{pypi_name}


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

%if %{with docs}
%files doc
%doc html
%license LICENSE