Blame python-datrie.spec

949bd50
%bcond tests 1
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
9152cab
Release:        %autorelease
39ab8c4
Summary:        Super-fast, efficiently stored Trie for Python
39ab8c4
39ab8c4
License:        LGPLv2
39ab8c4
URL:            https://github.com/pytries/%{pypi_name}
5a57f72
Source:         %{pypi_source %{pypi_name}}
39ab8c4
# Patch to correctly decode on big/little endian systems
39ab8c4
# https://github.com/pytries/datrie/issues/38
3a22f35
Patch:          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
9152cab
%autochangelog