Blob Blame History Raw
%global pypi_name textdistance

Name:           python-%{pypi_name}
Version:        4.2.0
Release:        %autorelease
Summary:        Compute distance between the two texts

License:        MIT
URL:            https://github.com/orsinium/textdistance
Source0:        %{pypi_source %{pypi_name}}

# numpy 1.24.x removes numpy.int and so on
Patch0:         https://github.com/life4/textdistance/pull/75.patch
# JaroWinkler boosting fix
Patch1:         https://github.com/life4/textdistance/pull/76.patch

BuildArch:      noarch

BuildRequires:  python3-devel
BuildRequires:  python3dist(setuptools)

# required for tests
BuildRequires:  python3dist(pytest)
BuildRequires:  python3dist(hypothesis)
BuildRequires:  python3dist(numpy)
BuildRequires:  python3dist(jellyfish)

%global _description %{expand:
TextDistance - python library for comparing distance between two or more
sequences by many algorithms.

Features:

  • 30+ algorithms
  • Pure python implementation
  • Simple usage
  • More than two sequences comparing
  • Some algorithms have more than one implementation in one class.
  • Optional numpy usage for maximum speed.}

%description %{_description}


%package -n     python3-%{pypi_name}
Summary:        %{summary}
%{?python_provide:%python_provide python3-%{pypi_name}}

%description -n python3-textdistance %{_description}


%prep
%autosetup -n %{pypi_name}-%{version} -p1
# Remove bundled egg-info
rm -rf %{pypi_name}.egg-info


%build
%py3_build


%install
%py3_install

# Fix bad executable permission
mkdir -p %{buildroot}%{_docdir}/python3-%{pypi_name}
cp -pr README.md %{buildroot}%{_docdir}/python3-%{pypi_name}
chmod 644 %{buildroot}%{_docdir}/python3-%{pypi_name}/README.md


%check
# disable tests that need abydos
%{__python3} -m pytest -v -k 'not test_list_of_numbers and not test_qval and not test_compare'


%files -n python3-%{pypi_name}
%license LICENSE
%{_docdir}/python3-%{pypi_name}
%{python3_sitelib}/%{pypi_name}
%{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info


%changelog
%autochangelog