a7fad7b
Name:           python-xxhash
a7fad7b
Version:        2.0.2
a7fad7b
Release:        %autorelease
a7fad7b
Summary:        Python Binding for xxHash
a7fad7b
a7fad7b
# Note LICENSE mentions GPLv2 for “xxhsum command line interface”; that is not
a7fad7b
# included in this package, so the license is BSD only.
a7fad7b
License:        BSD
a7fad7b
URL:            https://github.com/ifduyue/python-xxhash
a7fad7b
Source0:        %{pypi_source xxhash}
a7fad7b
a7fad7b
BuildRequires:  python3-devel
a7fad7b
a7fad7b
BuildRequires:  gcc
a7fad7b
BuildRequires:  pkgconfig(libxxhash)
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
a7fad7b
%pyproject_buildrequires -r
a7fad7b
a7fad7b
a7fad7b
%build
a7fad7b
%set_build_flags
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)"
a7fad7b
export XXHASH_LINK_SO='Non-empty string'
a7fad7b
%pyproject_wheel
a7fad7b
a7fad7b
a7fad7b
%install
a7fad7b
%pyproject_install
a7fad7b
%pyproject_save_files xxhash
a7fad7b
a7fad7b
a7fad7b
%check
a7fad7b
cd tests
a7fad7b
PYTHONPATH='%{buildroot}%{python3_sitearch}' \
a7fad7b
    %{__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