## START: Set by rpmautospec
## (rpmautospec version 0.3.1)
## 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

%global forgeurl https://github.com/maxbachmann/RapidFuzz
Version:        2.13.7
%forgemeta

%global srcname rapidfuzz

Name:           python-%{srcname}
Release:        %{autorelease}
Summary:        A fast string matching library for Python

License:        MIT
URL:            %{forgeurl}
Source:         %{forgesource}
# A few tweaks which allow rapidfuzz to run on Cython 0.29 (it is targeted at
# Cython 3 in the upstream.)
Patch0:         rapidfuzz-2.13.7-cython-0.29-backport.patch

# Basic build reqs
BuildRequires: cmake
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: python3-devel
BuildRequires: python3-Cython
BuildRequires: python3-scikit-build
BuildRequires: rapidfuzz-cpp-static
BuildRequires: taskflow-static
# For tests
BuildRequires: python3-hypothesis
BuildRequires: python3-pytest
BuildRequires: python3-pandas

%global _description %{expand:
RapidFuzz is a fast string matching library for Python, with optional C++
optimizations, which is using the string similarity calculations from
FuzzyWuzzy. RapidFuzz comes with a number of additional string metrics as well
as performance improvements over the original FuzzyWuzzy implementation.}

%description %_description

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

%description -n python3-%{srcname} %_description


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


%generate_buildrequires
%pyproject_buildrequires


%build
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files rapidfuzz

%check
%pyproject_check_import
%pytest


%files -n python3-%{srcname} -f %{pyproject_files}
%license LICENSE
%doc README.md


%changelog
* Sun Dec 25 2022 Troy Curtis Jr <troy@troycurtisjr.com> - 2.13.7-1
- Initial specfile.