a7fad7b
Name:           python-xxhash
b3e0d4b
Version:        3.4.1
a7fad7b
Release:        %autorelease
a7fad7b
Summary:        Python Binding for xxHash
a7fad7b
087d2d0
# The entire source is BSD-2-Clause. When the PyPI sdist is used (vs. the
087d2d0
# GitHub archive), a bundled copy of portions of the xxhash C library is also
087d2d0
# present in the source archive; it is under the same license and is removed in
087d2d0
# %%prep.
087d2d0
License:        BSD-2-Clause
a7fad7b
URL:            https://github.com/ifduyue/python-xxhash
44a2209
Source:         %{pypi_source xxhash}
a7fad7b
a7fad7b
BuildRequires:  python3-devel
a7fad7b
a7fad7b
BuildRequires:  gcc
738dcfd
BuildRequires:  pkgconfig(libxxhash) >= 0.8.2
a7fad7b
a7fad7b
%global common_description %{expand:
a7fad7b
xxhash is a Python binding for the xxHash library by Yann Collet.}
a7fad7b
a7fad7b
%description %{common_description}
a7fad7b
a7fad7b
a7fad7b
%package -n python3-xxhash
a7fad7b
Summary:        %{summary}
a7fad7b
a7fad7b
%description -n python3-xxhash %{common_description}
a7fad7b
a7fad7b
a7fad7b
%prep
a7fad7b
%autosetup -n xxhash-%{version}
a7fad7b
# Remove bundled xxhash library
a7fad7b
rm -rvf deps
a7fad7b
a7fad7b
a7fad7b
%generate_buildrequires
087d2d0
%pyproject_buildrequires
a7fad7b
a7fad7b
a7fad7b
%build
a7fad7b
# Normally, no extra flags are required to link the xxhash shared library, but
a7fad7b
# we are prepared:
a7fad7b
export CFLAGS="${CFLAGS} $(pkgconf --cflags libxxhash)"
a7fad7b
export LDFLAGS="${LDFLAGS} $(pkgconf --libs-only-L libxxhash)"
a7fad7b
export LDFLAGS="${LDFLAGS} $(pkgconf --libs-only-other libxxhash)"
2bae614
export XXHASH_LINK_SO='1'
a7fad7b
%pyproject_wheel
a7fad7b
a7fad7b
a7fad7b
%install
a7fad7b
%pyproject_install
a7fad7b
%pyproject_save_files xxhash
a7fad7b
a7fad7b
a7fad7b
%check
a7fad7b
cd tests
e4ff4d3
PYTHONPATH='%{buildroot}%{python3_sitearch}' %{python3} -m unittest discover
a7fad7b
a7fad7b
a7fad7b
%files -n python3-xxhash -f %{pyproject_files}
a7fad7b
%doc CHANGELOG.rst
a7fad7b
%doc README.rst
a7fad7b
a7fad7b
a7fad7b
%changelog
a7fad7b
%autochangelog