# Sphinx-generated HTML documentation is not suitable for packaging; see
# https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion.
#
# We can generate PDF documentation as a substitute.
%bcond_without doc_pdf
Name: python-signature-dispatch
Version: 1.0.0
Release: %autorelease
Summary: Overload functions based on their call signature and type annotations
License: MIT
URL: https://github.com/kalekundert/signature_dispatch
Source0: %{pypi_source signature_dispatch}
# Remove useless shebang lines
# https://github.com/kalekundert/signature_dispatch/pull/2
Patch0: %{url}/pull/2.patch
BuildArch: noarch
BuildRequires: python3-devel
%if %{with doc_pdf}
BuildRequires: make
BuildRequires: python3-sphinx-latex
BuildRequires: latexmk
BuildRequires: python3-docs
%endif
%global common_description %{expand:
This package provides a simple python library for overloading functions based
on their call signature and type annotations.}
%description %{common_description}
%package -n python3-signature-dispatch
Summary: %{summary}
%description -n python3-signature-dispatch %{common_description}
%package doc
Summary: Documentation and examples for signature_dispatch
%description doc %{common_description}
%prep
%autosetup -n signature_dispatch-%{version} -p1
# Patch out coverage dependencies
sed -r -i '/\b(pytest-cov|coveralls)\b/d' pyproject.toml
# Use local inventories in intersphinx mappings.
sed -r -i 's@https?://docs.python.org/3?@/%{_docdir}/python3-docs/html@' \
docs/conf.py
%generate_buildrequires
%pyproject_buildrequires -x test%{?with_doc_pdf:,doc}
%build
%pyproject_wheel
%if %{with doc_pdf}
PYTHONPATH="${PWD}" %make_build -C docs latex SPHINXOPTS='%{?_smp_mflags}'
%make_build -C docs/_build/latex LATEXMKOPTS='-quiet'
%endif
%install
%pyproject_install
%pyproject_save_files signature_dispatch
%check
%pytest tests
%files -n python3-signature-dispatch -f %{pyproject_files}
%license LICENSE.txt
%doc README.rst
%files doc
%license LICENSE.txt
%doc README.rst
%if %{with doc_pdf}
%doc docs/_build/latex/signature_dispatch.pdf
%endif
%changelog
%autochangelog