Blob Blame History Raw
%bcond_without tests

%global pypi_name editdistance

%global _description %{expand:
Fast implementation of the edit distance (Levenshtein distance).

This library simply implements Levenshtein distance with C++ and Cython.

The algorithm used in this library is proposed by Heikki Hyyrö,
"Explaining and extending the bit-parallel approximate string matching
algorithm of Myers", (2001).}

Name:           python-%{pypi_name}
Version:        0.5.3
Release:        3%{?dist}
Summary:        Fast implementation of the Levenshtein distance

License:        MIT
URL:  {pypi_name}


%description %_description

%package -n python3-%{pypi_name}
Summary:        %{summary}
BuildRequires:  python3-devel
BuildRequires:  %{py3_dist Cython}
BuildRequires:  gcc-c++

%if %{with tests}
BuildRequires:  %{py3_dist pytest}

%{?python_provide:%python_provide python3-%{pypi_name}}

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

%autosetup -n %{pypi_name}-%{version}
rm -rf %{pypi_name}.egg-info
# _editdistance.cpp is not generated by the Cython compiler.
find %{pypi_name}/ -name "bycython.cpp" -print -delete
find . -type f -name "*.py" -exec sed -i '/^#![  ]*\/usr\/bin\/env.*$/ d' {} 2>/dev/null ';'

# compile the source file "bycython.cpp" manually. does not do that itself.
cythonize --inplace %{pypi_name}/bycython.pyx


%if %{with tests}
export PYTHONPATH=%{buildroot}%{python3_sitearch}

%files -n python3-%{pypi_name}
%doc README.rst
%license LICENSE

# own the installation directory
%dir %{python3_sitearch}/%{pypi_name}
# own the __pycache__ directory
%dir %{python3_sitearch}/%{pypi_name}/__pycache__/

%exclude %{python3_sitearch}/%{pypi_name}/*.h

* Tue May 26 2020 Miro Hrončok <> - 0.5.3-3
- Rebuilt for Python 3.9

* Thu Jan 30 2020 Fedora Release Engineering <> - 0.5.3-2
- Rebuilt for

* Fri Nov 8 2019 Aniket Pradhan <major AT fedoraproject DOT org> - 0.5.3-1
- Initial build