39ab8c4
%bcond_without tests
39ab8c4
39ab8c4
%global pypi_name datrie
39ab8c4
39ab8c4
%global _description %{expand:
39ab8c4
The library implements the Trie data structure. The trie variable is a
39ab8c4
dict-like object that can have Unicode keys of certain ranges and Python
39ab8c4
objects as values.
39ab8c4
39ab8c4
In addition to implementing the mapping interface, the library tries to
39ab8c4
facilitate finding the items for a given prefix, and vice versa, finding the
39ab8c4
items whose keys are prefixes of a given string. As a common special case,
39ab8c4
finding the longest-prefix item is also supported.}
39ab8c4
39ab8c4
Name:           python-%{pypi_name}
39ab8c4
Version:        0.8.2
1923d29
Release:        5%{?dist}
39ab8c4
Summary:        Super-fast, efficiently stored Trie for Python
39ab8c4
39ab8c4
License:        LGPLv2
39ab8c4
URL:            https://github.com/pytries/%{pypi_name}
39ab8c4
Source0:        %{pypi_source}
39ab8c4
# Patch to correctly decode on big/little endian systems
39ab8c4
# https://github.com/pytries/datrie/issues/38
39ab8c4
Patch0:			0001-BUG-Decode-string-based-on-byteorder-of-system.patch
39ab8c4
39ab8c4
%description %_description
39ab8c4
39ab8c4
%package -n python3-%{pypi_name}
39ab8c4
Summary:        %{summary}
39ab8c4
BuildRequires:  gcc-c++
39ab8c4
BuildRequires:  libdatrie
39ab8c4
BuildRequires:  python3-devel
39ab8c4
BuildRequires:  %{py3_dist Cython}
39ab8c4
BuildRequires:  %{py3_dist setuptools}
39ab8c4
39ab8c4
%if %{with tests}
39ab8c4
BuildRequires:  %{py3_dist pytest}
39ab8c4
BuildRequires:  %{py3_dist pytest-runner}
39ab8c4
BuildRequires:  %{py3_dist hypothesis}
39ab8c4
%endif
39ab8c4
39ab8c4
%py_provides python3-%{pypi_name}
39ab8c4
39ab8c4
%description -n python3-%{pypi_name} %_description
39ab8c4
39ab8c4
%prep
39ab8c4
%autosetup -p1 -n %{pypi_name}-%{version}
39ab8c4
rm -rf %{pypi_name}.egg-info
39ab8c4
39ab8c4
# use system's libdatrie
39ab8c4
sed -i -e 's/..\/libdatrie\///g' src/cdatrie.pxd
39ab8c4
39ab8c4
find . -type f -name "*.py" -exec sed -i '/^#![  ]*\/usr\/bin\/env.*$/ d' {} 2>/dev/null ';'
39ab8c4
39ab8c4
%build
39ab8c4
%py3_build
39ab8c4
39ab8c4
%install
39ab8c4
%py3_install
39ab8c4
39ab8c4
%check
39ab8c4
%if %{with tests}
39ab8c4
export PYTHONPATH=%{buildroot}%{python3_sitearch}
39ab8c4
pytest-%{python3_version}
39ab8c4
%endif
39ab8c4
39ab8c4
%files -n python3-%{pypi_name}
39ab8c4
%doc README.rst
39ab8c4
%license COPYING
39ab8c4
39ab8c4
%{python3_sitearch}/datrie.cpython-*.so
39ab8c4
%{python3_sitearch}/%{pypi_name}-%{version}-py%{python3_version}.egg-info
39ab8c4
39ab8c4
39ab8c4
%changelog
1923d29
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.8.2-5
1923d29
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
1923d29
d00d9f6
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.8.2-4
d00d9f6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
d00d9f6
ad823ab
* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 0.8.2-3
ad823ab
- Rebuilt for Python 3.10
ad823ab
e4d40b4
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.8.2-2
e4d40b4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
e4d40b4
39ab8c4
* Sat Nov 21 2020 Aniket Pradhan <major AT fedoraproject DOT org> - 0.8.2-1
39ab8c4
- Initial build