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

Name:           python-%{srcname}
Version:        0.14.1
Release:        %autorelease
Summary:        Buffer compression and transformation for data storage and communication

License:        MIT
URL:            https://github.com/zarr-developers/numcodecs
Source0:        %pypi_source %{srcname}
# Fedora specific
Patch:          0001-Unbundle-blosc.patch
Patch:          0002-Unbundle-zstd.patch
Patch:          0003-Unbundle-lz4.patch
# Fedora is not missing Snappy support in Blosc.
Patch:          0004-Re-add-Snappy-to-tests.patch
# We don't need coverage reports, and don't want to test the current directory.
Patch:          0005-Fix-testing-setup-for-Fedora.patch
# Allow older NumPy.
Patch:          0006-Reduce-numpy-build-requirement.patch

# Fix a bug in delta filter.
Patch:          https://github.com/zarr-developers/numcodecs/pull/677.patch

# Stop building on i686
# https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval
ExcludeArch:    %{ix86}

BuildRequires:  gcc
BuildRequires:  pkgconfig(blosc)
BuildRequires:  pkgconfig(liblz4)
BuildRequires:  pkgconfig(libzstd)
BuildRequires:  python3-devel

%description
Numcodecs is a Python package providing buffer compression and transformation
codecs for use in data storage and communication applications.


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

%description -n python3-%{srcname}
Numcodecs is a Python package providing buffer compression and transformation
codecs for use in data storage and communication applications.


%package -n python-%{srcname}-doc
Summary:        numcodecs documentation

BuildArch:      noarch

%description -n python-%{srcname}-doc
Documentation for numcodecs


%prep
%autosetup -n %{srcname}-%{version} -p1

# Remove bundled blosc
rm -rf c-blosc


%generate_buildrequires
%pyproject_buildrequires -x crc32c,docs,msgpack,test,test_extras


%build
%pyproject_wheel

# generate html docs
PYTHONPATH="$PWD/build/lib.%{python3_platform}-cpython-%{python3_version_nodots}" sphinx-build-3 docs html
# remove the sphinx-build leftovers
rm -rf html/.{doctrees,buildinfo} html/_static/donotdelete


%install
%pyproject_install
%pyproject_save_files -l %{srcname}


%check
rm pyproject.toml
cd docs  # Avoid using unbuilt existing copy.
ln -s ../fixture
%{pytest} --pyargs numcodecs


%files -n python3-%{srcname} -f %{pyproject_files}
%doc README.rst
%license LICENSE.txt

%files -n python-%{srcname}-doc
%doc html
%license LICENSE.txt


%changelog
## START: Generated by rpmautospec
* Mon Jan 13 2025 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.14.1-3
- Backport fix for delta filter

* Thu Dec 19 2024 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.14.1-2
- Rebuild for NumPy 2

* Fri Nov 22 2024 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.14.1-1
- Update to latest version (#2325895)

* Sat Oct 12 2024 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.13.1-1
- Update to latest version (#2317626)

* Tue Sep 17 2024 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.13.0-2
- Backport fix for Python 3.13

* Sun Jul 21 2024 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.13.0-1
- Update to latest version (#2297882)

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

* Mon Jun 24 2024 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.12.1-5
- Drop support for i686 builds

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

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

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

* Mon Nov 20 2023 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.12.1-1
- Update to latest version (#2244738)

* Sun Oct 08 2023 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.12.0-1
- Update to latest version (#2242551)

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

* Wed Jun 28 2023 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.11.0-5
- Backport fix for NumPy 1.24 compatibility

* Wed Jun 28 2023 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.11.0-4
- Remove deprecated pyproject_build_lib macro

* Wed Jun 28 2023 Python Maint <python-maint@redhat.com> - 0.11.0-3
- Rebuilt for Python 3.12

* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.11.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Sun Dec 18 2022 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.11.0-1
- Update to latest version (#2154102)

* Tue Aug 02 2022 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.10.2-1
- Update to latest version (#2113057)

* Sun Jul 31 2022 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.10.1-1
- Update to latest version (#2046180)

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

* Wed Jun 15 2022 Python Maint <python-maint@redhat.com> - 0.9.1-4
- Rebuilt for Python 3.11

* Sun Jan 30 2022 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.9.1-3
- Fix docs FTBFS; fixes rhbz#2046894

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

* Sun Sep 05 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.9.1-1
- Update to latest version (#2001361)

* Fri Aug 20 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.9.0-1
- Update to latest version (#1991491)

* Fri Aug 20 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.8.0-5
- Switch to latest Python macros.

* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.8.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Sat Jun 19 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.8.0-1
- Update to latest version (#1972090)

* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 0.7.3-2
- Rebuilt for Python 3.10

* Sat Feb 06 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.7.3-1
- Update to latest version (#1920355)

* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

* Wed Sep 16 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.7.2-1
- Update to latest version (#1879444)

* Fri Sep 11 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.7.1-1
- Update to latest version (#1877913)

* Wed Sep 09 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.7.0-1
- Update to latest version (#1877567)

* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.6.4-5
- Second attempt - Rebuilt for
  https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.6.4-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 0.6.4-3
- Rebuilt for Python 3.9

* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.6.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

* Mon Nov 11 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.6.4-1
- Update to latest version

* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 0.6.3-6
- Rebuilt for Python 3.8.0rc1 (#1748018)

* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 0.6.3-5
- Rebuilt for Python 3.8

* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.6.3-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

* Sun Jul 21 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.6.3-3
- Fix build against latest NumPy

* Mon Mar 18 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.6.3-2
- Fix broken doc build and test running
- Make doc subpackage noarch

* Sat Mar 16 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.6.3-1
- Initial package.

## END: Generated by rpmautospec