## START: Set by rpmautospec
## (rpmautospec version 0.6.0)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 5;
    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-rapidfuzz
Version:        3.5.2
Release:        %autorelease
Summary:        Rapid fuzzy string matching in Python and C++ using the Levenshtein Distance

License:        MIT
URL:            https://github.com/maxbachmann/RapidFuzz
Source:         %{pypi_source rapidfuzz}

BuildRequires:  gcc
BuildRequires:  gcc-c++
BuildRequires:  python3-devel
BuildRequires:  python3-hypothesis
# Pandas will drop i686
# https://bugzilla.redhat.com/show_bug.cgi?id=2263999
%ifnarch %{ix86}
BuildRequires:  python3-pandas
%endif
BuildRequires:  python3-pytest
# The PyPi sources don't depend on Cython since they contain pre-generated sources,
# but those are rebuilt for Fedora so Cython must be available.
BuildRequires:  python3-cython >= 3
BuildRequires:  rapidfuzz-cpp-static
BuildRequires:  taskflow-static

%global _description %{expand:
RapidFuzz is a fast string matching library for Python and C++, which is using
the string similarity calculations from FuzzyWuzzy. However there are a couple
of aspects that set RapidFuzz apart from FuzzyWuzzy:
- It is MIT licensed so it can be used whichever License you might want
to choose for your project, while you're forced to adopt the GPL license when
using FuzzyWuzzy
- It provides many string_metrics like hamming or jaro_winkler, which
are not included in FuzzyWuzzy
- It is mostly written in C++ and on top of this comes with a lot of Algorithmic
improvements to make string matching even faster, while still providing the same
results. For detailed benchmarks check the documentation
- Fixes multiple bugs in the partial_ratio implementation}

%description %_description

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

%description -n python3-rapidfuzz %_description


%pyproject_extras_subpkg -n python3-rapidfuzz full

%package -n python3-rapidfuzz-devel
Summary:        Development files for the RapidFuzz library

Requires: python3-rapidfuzz%{?_isa} = %{version}-%{release}

%description -n python3-rapidfuzz-devel
%_description


%prep
%autosetup -p1 -n rapidfuzz-%{version}
# External dependencies (rapidfuzz-cpp and taskflow) are removed here,
# they are already packaged in Fedora and we BuildRequire them above.
rm extern -r

# Remove pregenerated Cython sources
rm $(grep -rl '/\* Generated by Cython')

# Adjust version constraint to make rapidfuzz build
# with the current version of scikit-build in Fedora
sed -i 's/scikit-build~=0.16.2/scikit-build~=0.17.1/' pyproject.toml


%generate_buildrequires
%pyproject_buildrequires -x full


%build
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files rapidfuzz


%check
%pytest -v


%files -n python3-rapidfuzz -f %{pyproject_files}
%doc README.*
%exclude %{python3_sitearch}/rapidfuzz/rapidfuzz.h
%exclude %{python3_sitearch}/rapidfuzz/__init__.pxd

%files -n python3-rapidfuzz-devel
%{python3_sitearch}/rapidfuzz/rapidfuzz.h
%{python3_sitearch}/rapidfuzz/__init__.pxd


%changelog
## START: Generated by rpmautospec
* Wed Mar 06 2024 Sandro <devel@penguinpee.nl> - 3.5.2-5
- Drop dependency on pandas for i686

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

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

* Thu Jan 18 2024 Tomáš Hrnčiar <thrnciar@redhat.com> - 3.5.2-2
- Add missing sources

* Fri Dec 15 2023 Tomáš Hrnčiar <thrnciar@redhat.com> - 3.5.2-1
- Update to 3.5.2
- Fixes: rhbz#2183537

* Mon Aug 07 2023 Troy Curtis Jr <troy@troycurtisjr.com> - 2.13.7-8
- Fix build for Cython 3.0.0.

* Mon Aug 07 2023 Miro Hrončok <miro@hroncok.cz> - 2.13.7-7
- Build with Cython 3

* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.13.7-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Sat Jul 01 2023 Python Maint <python-maint@redhat.com> - 2.13.7-5
- Rebuilt for Python 3.12

* Thu Jun 01 2023 Tomáš Hrnčiar <thrnciar@redhat.com> - 2.13.7-4
- Remove pregenerated Cython 3 sources and recreate them with Cython 0.29.x

* Fri Feb 10 2023 Tomáš Hrnčiar <thrnciar@redhat.com> - 2.13.7-1
- Initial package

## END: Generated by rpmautospec