## START: Set by rpmautospec
## (rpmautospec version 0.7.3)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 4;
    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

%global pypi_name intbitset

Name:           python-%{pypi_name}
Version:        3.1.0
Release:        %autorelease
Summary:        Python C-based extension implementing fast integer bit sets

License:        LGPL-3.0-or-later
URL:            https://github.com/inveniosoftware-contrib/intbitset
Source:         %url/archive/v%{version}/%{pypi_name}-%{version}.tar.gz
# Fix for Python 3.13: use new buffer protocols
Patch:          0001-Convert-old-buffer-protocols-to-Python-3-buffer-prot.patch

BuildRequires:  gcc
BuildRequires:  python3-devel
BuildRequires:  Cython
BuildRequires:  python3dist(pytest)
BuildRequires:  python3dist(sphinx)

%global common_description %{expand:
The intbitset library provides a set implementation to store sorted unsigned
integers either 32-bits integers (between 0 and 2**31 - 1 or
intbitset.__maxelem__) or an infinite range with fast set operations implemented
via bit vectors in a Python C extension for speed and reduced memory usage.

The inbitset class emulates the Python built-in set class interface with some
additional specific methods such as its own fast dump and load marshalling
functions.}

%description %{common_description}

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

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

%package -n python-%{pypi_name}-doc
Summary:        Documentation for python-%{pypi_name}
# BSD-2-Clause: Sphinx javascript
# MIT: jquery
License:        LGPL-3.0-or-later AND BSD-2-Clause AND MIT
BuildArch:      noarch
Requires:       python3-%{pypi_name} = %{?epoch:%{epoch}:}%{version}-%{release}
Provides:       bundled(js-sphinx_javascript_frameworks_compat)
Provides:       bundled(js-doctools)
Provides:       bundled(js-jquery)
Provides:       bundled(js-language_data)
Provides:       bundled(js-searchtools)

%description -n python-%{pypi_name}-doc
%{common_description}

This package is providing the documentation for %{pypi_name}.

%prep
%autosetup -p1 -n %{pypi_name}-%{version}
rm -rfv src/intbitset.c

%generate_buildrequires
%pyproject_buildrequires

%build
cython intbitset/intbitset.pyx
%pyproject_wheel

# generate html docs
sphinx-build-3 -b html docs/ html
# remove the sphinx-build-3 leftovers
rm -rf html/.{doctrees,buildinfo}

%install
%pyproject_install
%pyproject_save_files %{pypi_name}

%check
%pytest -k 'not test_set_consistency'

%files -n python3-%{pypi_name} -f %{pyproject_files}
%pycached %{python3_sitearch}/intbitset_*.py

%files -n python-%{pypi_name}-doc
%doc html

%changelog
## START: Generated by rpmautospec
* Fri Jul 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild

* Fri Jun 21 2024 Robert-André Mauchin <zebob.m@gmail.com> - 3.1.0-3
- Fix FTBFS with Python 3.13

* Fri Jun 07 2024 Python Maint <python-maint@redhat.com> - 3.1.0-2
- Rebuilt for Python 3.13

* Wed May 22 2024 Robert-André Mauchin <zebob.m@gmail.com> - 3.1.0-1
- Update to 3.1.0

* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Sat Oct 28 2023 Robert-André Mauchin <zebob.m@gmail.com> - 3.0.2-1
- Initial import
## END: Generated by rpmautospec