Blob Blame History Raw
%bcond tests 1

%global _description %{expand:
The library implements the Trie data structure. The trie variable is a
dict-like object that can have Unicode keys of certain ranges and Python
objects as values.

In addition to implementing the mapping interface, the library tries to
facilitate finding the items for a given prefix, and vice versa, finding the
items whose keys are prefixes of a given string. As a common special case,
finding the longest-prefix item is also supported.}

Name:           python-datrie
Version:        0.8.2
Release:        %autorelease
Summary:        Super-fast, efficiently stored Trie for Python

License:        LGPL-2.1-or-later
Source:         %{pypi_source datrie}
# BUGFIX: Decode string based on byteorder of system
# Fixes:
# UnicodeDecodeError: 'utf32' codec can't decode bytes in position 0-3: code
# point not in range(0x110000)
Patch:          %{url}/pull/85.patch
# Fix AlphaMap definition in cdatrie.pxd
# Fixes failure to compile on GCC with -Werror=incompatible-pointer-types.
# Fixes:
# python-datrie: FTBFS in Fedora rawhide/f40
Patch:          %{url}/pull/99.patch

BuildRequires:  python3-devel

BuildRequires:  gcc-c++
BuildRequires:  libdatrie

%description %_description

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

%description -n python3-datrie %_description

%autosetup -p1 -n datrie-%{version}

# use system's libdatrie
sed -r -i -e 's@\.\./libdatrie/@@g' src/cdatrie.pxd

%pyproject_buildrequires -t


%pyproject_save_files -l datrie

%if %{with tests}

%files -n python3-datrie -f %{pyproject_files}
%doc README.rst