## START: Set by rpmautospec
## (rpmautospec version 0.6.0)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 1;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

Name:           python-beartype
Version:        0.17.2
Release:        %autorelease
Summary:        Unbearably fast runtime type checking in pure Python
License:        MIT
URL:            https://beartype.readthedocs.io
Source:         %{pypi_source beartype}
BuildArch:      noarch

BuildRequires:  python3-devel
BuildRequires:  python3dist(pytest) 
BuildRequires:  python3dist(sphinx)
BuildRequires:  make

%global _description %{expand:
An open-source pure-Python PEP-compliant near-real-time hybrid
runtime-static third-generation type checker emphasizing efficiency,
usability, unsubstantiated jargon we just made up, and thrilling puns.}

%description %_description

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

%description -n python3-beartype %_description

%prep
%autosetup -p1 -n beartype-%{version}

%generate_buildrequires
%pyproject_buildrequires -r

%build
%pyproject_wheel
(cd doc; make man singlehtml)

%install
%pyproject_install
%pyproject_save_files beartype
install -m0644 -D doc/trg/man/beartype.1 %{buildroot}%{_mandir}/man1/beartype.1
gzip %{buildroot}%{_mandir}/man1/beartype.1
mv doc/trg/singlehtml/index.html beartype.html
# https://github.com/beartype/beartype/issues/331
find %{buildroot}/%{python3_sitelib} -type f -name \*.py -print0 | xargs -0  sed -i "s:#\!/usr/bin/env python3:# :"

%check
%pyproject_check_import
%pytest beartype_test

%files -n python3-beartype -f %{pyproject_files}
%license LICENSE
%doc beartype.html
%{_mandir}/man1/beartype.1.gz

%changelog
## START: Generated by rpmautospec
* Tue Feb 20 2024 Paul Wouters <paul.wouters@aiven.io> - 0.17.2-1
- Initial package (0.17.2) (rhbz#2264793)
## END: Generated by rpmautospec