Blob Blame History Raw
%bcond_without tests

%global pypi_name datrie

%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-%{pypi_name}
Version:        0.8.2
Release:        1%{?dist}
Summary:        Super-fast, efficiently stored Trie for Python

License:        LGPLv2
URL:  {pypi_name}
Source0:        %{pypi_source}
# Patch to correctly decode on big/little endian systems
Patch0:			0001-BUG-Decode-string-based-on-byteorder-of-system.patch

%description %_description

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

%if %{with tests}
BuildRequires:  %{py3_dist pytest}
BuildRequires:  %{py3_dist pytest-runner}
BuildRequires:  %{py3_dist hypothesis}

%py_provides python3-%{pypi_name}

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

%autosetup -p1 -n %{pypi_name}-%{version}
rm -rf %{pypi_name}.egg-info

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

find . -type f -name "*.py" -exec sed -i '/^#![  ]*\/usr\/bin\/env.*$/ d' {} 2>/dev/null ';'



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

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


* Sat Nov 21 2020 Aniket Pradhan <major AT fedoraproject DOT org> - 0.8.2-1
- Initial build