## START: Set by rpmautospec
## (rpmautospec version 0.3.0)
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 1;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

Name:           python-xxhash
Version:        3.1.0
Release:        %autorelease
Summary:        Python Binding for xxHash

# The entire source is BSD-2-Clause. When the PyPI sdist is used (vs. the
# GitHub archive), a bundled copy of portions of the xxhash C library is also
# present in the source archive; it is under the same license and is removed in
# %%prep.
License:        BSD-2-Clause
URL:            https://github.com/ifduyue/python-xxhash
Source0:        %{pypi_source xxhash}

BuildRequires:  python3-devel

BuildRequires:  gcc
BuildRequires:  pkgconfig(libxxhash)

%global common_description %{expand:
xxhash is a Python binding for the xxHash library by Yann Collet.}

%description %{common_description}


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

%description -n python3-xxhash %{common_description}


%prep
%autosetup -n xxhash-%{version}
# Remove bundled xxhash library
rm -rvf deps


%generate_buildrequires
%pyproject_buildrequires


%build
%set_build_flags
# Normally, no extra flags are required to link the xxhash shared library, but
# we are prepared:
export CFLAGS="${CFLAGS} $(pkgconf --cflags libxxhash)"
export LDFLAGS="${LDFLAGS} $(pkgconf --libs-only-L libxxhash)"
export LDFLAGS="${LDFLAGS} $(pkgconf --libs-only-other libxxhash)"
export XXHASH_LINK_SO='1'
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files xxhash


%check
cd tests
PYTHONPATH='%{buildroot}%{python3_sitearch}' %{python3} -m unittest discover


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


%changelog
* Fri Oct 21 2022 Benjamin A. Beasley <code@musicinmybrain.net> 3.1.0-1
- Update to 3.1.0 (close RHBZ#2136692)
- Convert License to SPDX

* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> 3.0.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> 3.0.0-2
- Rebuilt for Python 3.11

* Sat Feb 26 2022 Benjamin A. Beasley <code@musicinmybrain.net> 3.0.0-1
- Update to 3.0.0 (close RHBZ#2058811)

* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> 2.0.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Mon Oct 25 2021 Benjamin A. Beasley <code@musicinmybrain.net> 2.0.2-2
- Use %%%%python3 macro instead of %%%%__python3

* Fri Sep 17 2021 Benjamin A. Beasley <code@musicinmybrain.net> 2.0.2-1
- Initial package