## START: Set by rpmautospec
## (rpmautospec version 0.7.3)
## 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-nh3
Version:        0.2.20
Release:        %autorelease
Summary:        Python binding to Ammonia HTML sanitizer Rust crate
License:        MIT
URL:            https://github.com/messense/nh3
Source:         %{pypi_source nh3}

# This disable pyo3 feature requirement specific for windows
Patch:          do_not_require_win_only_pyo3_extension.patch

BuildRequires:  cargo-rpm-macros
BuildRequires:  python3-devel

# For tests
BuildRequires:  python3dist(pytest)

%global _description %{expand:
Python binding to Ammonia HTML sanitizer Rust crate.}

%description %_description

%package -n python3-nh3
Summary:        %{summary}
# Full license breakdown in LICENSES.dependencies
License:        MIT AND Apache-2.0 AND (MIT OR Apache-2.0) AND (Zlib OR Apache-2.0 OR MIT)

%description -n python3-nh3 %_description


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

%cargo_prep


%generate_buildrequires
%pyproject_buildrequires
%cargo_generate_buildrequires


%build
export RUSTFLAGS='%{build_rustflags}'
%cargo_license_summary
%{cargo_license} > LICENSES.dependencies
%pyproject_wheel


%install
%pyproject_install

%pyproject_save_files nh3


%check
%pytest -vv


%files -n python3-nh3 -f %{pyproject_files}
%license LICENSE LICENSES.dependencies
%doc README.md


%changelog
## START: Generated by rpmautospec
* Mon Dec 23 2024 Mattia Verga <mattia.verga@proton.me> - 0.2.20-1
- Update to 0.2.20 (fedora#2332810)

* Sat Dec 14 2024 Mattia Verga <mattia.verga@proton.me> - 0.2.19-1
- Update to 0.2.19 (fedora#2329441)

* Wed Oct 16 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.2.18-3
- Revert "Fix automatic provides on Python extension due to SONAME"
- The fix is in rust-1.81.0-4 and later, which is now in all stable
  branches, so this workaround is no longer necessary.

* Fri Sep 27 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.2.18-2
- Fix automatic provides on Python extension due to SONAME

* Fri Sep 27 2024 Mattia Verga <mattia.verga@proton.me> - 0.2.18-1
- Update to 0.2.18 (fedora#2271589)

* Fri Jul 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.15-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild

* Fri Jun 07 2024 Python Maint <python-maint@redhat.com> - 0.2.15-4
- Rebuilt for Python 3.13

* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.15-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.15-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Thu Dec 28 2023 Mattia Verga <mattia.verga@proton.me> - 0.2.15-1
- Update to 0.2.15 (fedora#2253477)

* Sat Oct 21 2023 Mattia Verga <mattia.verga@proton.me> - 0.2.14-1
- Initial release (fedora#2244877)
## END: Generated by rpmautospec