## START: Set by rpmautospec
## (rpmautospec version 0.7.3)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 2;
    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-blosc2
Version:        2.7.1
Release:        %autorelease
Summary:        Python wrapper for the Blosc2 compression library
License:        BSD-3-Clause
URL:            https://blosc.org/python-blosc2/python-blosc2.html
Source:         https://github.com/Blosc/python-blosc2/archive/v%{version}/python-blosc2-%{version}.tar.gz

BuildRequires:  python3-devel
BuildRequires:  gcc-g++
BuildRequires:  ninja-build
BuildRequires:  blosc2-devel >= 2.13.1

ExcludeArch:    %{ix86}

%global _description %{expand:
C-Blosc2 is the new major version of C-Blosc, and is backward compatible with
both the C-Blosc1 API and its in-memory format. Python-Blosc2 is a Python
package that wraps C-Blosc2, the newest version of the Blosc compressor.

In addition, Python-Blosc2 aims to leverage the new C-Blosc2 API so as to
support super-chunks, multi-dimensional arrays (NDArray), serialization and
other bells and whistles introduced in C-Blosc2. Although this is always and
endless process, it has already caught up with most of the C-Blosc2 API
capabilities.}

%description %_description

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

%description -n python3-blosc2 %_description

%prep
%autosetup -p1

# This seems to be the best way to prevent the "bespoke build system" from doing
# a git clone.
rmdir blosc2/c-blosc2

# Did I say "bespoke build system"? Who needs configuration options.
# Configuration options are for woosies.
sed -r -i '/include_package_data=.*/a cmake_args=["-DUSE_SYSTEM_BLOSC2:BOOL=ON"],' \
    setup.py

# Those dependencies are generated incorrectly
sed -r -i 's/"(cmake|ninja)",//g;
           s/oldest-supported-//g;
           s/numpy>=2.*"/numpy"/;
          ' pyproject.toml
# NumPy is already specified in `pyproject.toml`.
sed -r -i '/numpy/d' requirements-test-wheels.txt

%generate_buildrequires
%pyproject_buildrequires requirements-test-wheels.txt

%build
export VERBOSE=1
%pyproject_wheel

%install
%pyproject_install
%pyproject_save_files blosc2

%check
OPTIONS=(
)

%pytest tests/ "${OPTIONS[@]}" -v \
%ifarch s390x
  || :    # https://github.com/Blosc/python-blosc2/issues/125
%endif

%files -n python3-blosc2 -f %{pyproject_files}
%doc README.rst RELEASE_NOTES.md

%changelog
## START: Generated by rpmautospec
* Wed Oct 30 2024 Sandro <devel@penguinpee.nl> - 2.7.1-2
- Allow building with NumPy 2.x

* Thu Oct 24 2024 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.7.1-1
- Version 2.7.1

* Thu Oct 24 2024 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.7.0-1
- Version 2.7.0

* Thu Oct 24 2024 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.6.2-1
- Version 2.6.2 (rhbz#2272541)

* Tue Sep 10 2024 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.5.1-5
- Rebuild for blosc2-2.15.1-1

* Fri Jul 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.5.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild

* Sat Jun 08 2024 Python Maint <python-maint@redhat.com> - 2.5.1-3
- Rebuilt for Python 3.13

* Sun Apr 21 2024 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.5.1-2
- Rebuild for blosc2-2.14.4

* Tue Jan 30 2024 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.5.1-1
- Version 2.5.1 (rhbz#2256095)

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

* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.3.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Sat Dec 02 2023 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.3.2-1
- Version 2.3.2 (rhbz#2252401)

* Sat Dec 02 2023 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.2.5-4
- Build with Cython 3

* Tue Jul 25 2023 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.2.5-3
- Build with cython-0.29

* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Sun Jul 16 2023 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.2.5-1
- Version 2.2.5

* Sun Jul 16 2023 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.2.2-6
- Skip all tests of s390x

* Sun Jul 16 2023 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.2.2-3
- Stop building for i686

* Sun Jul 16 2023 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.2.2-1
- Package is approved
## END: Generated by rpmautospec