## START: Set by rpmautospec
## (rpmautospec version 0.7.3)
## RPMAUTOSPEC: autorelease, autochangelog
%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

%bcond_with check
%global srcname tifffile

Name: python-%{srcname}
Version: 2024.12.12
Release: %autorelease
Summary: Read and write TIFF(r) files

License: BSD-3-Clause
URL: https://www.lfd.uci.edu/~gohlke/
Source0: %{pypi_source}

BuildArch: noarch

BuildRequires: python3-devel

%global _description %{expand:
Tifffile is a Python library to:
 * store numpy arrays in TIFF (Tagged Image File Format) files, and
 * read image and metadata from TIFF-like files used in bioimaging.}

%description %_description

%package -n python3-%{srcname}
Summary:        %{summary}
BuildRequires:  %{py3_dist setuptools}
# Testing
%if %{with check}
BuildRequires:  %{py3_dist pytest}
BuildRequires:  %{py3_dist numpy}
BuildRequires:  %{py3_dist fsspec}
%endif

%description -n python3-%{srcname} %_description

%prep
# Remove shebang
%autosetup -n %{srcname}-%{version}
sed -i -e "1d" tifffile/lsm2bin.py 
sed -i 's/\r$//' README.rst

%generate_buildrequires
%pyproject_buildrequires

%build
%pyproject_wheel

%install
%pyproject_install

%pyproject_save_files tifffile

%if %{with check}
%check
export PYTHONDONTWRITEBYTECODE=1
export PYTEST_ADDOPTS='-p no:cacheprovider'
export PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}}"
# 7 tests fail out of 1000 
# these tests require network or additional packages not in Fedora
pytest-%{python3_version} -v tests \
 --deselect=tests/test_tifffile.py::test_issue_infinite_loop \
 --deselect=tests/test_tifffile.py::test_issue_jpeg_ia \
 --deselect=tests/test_tifffile.py::test_func_pformat_xml \
 --deselect=tests/test_tifffile.py::test_filehandle_seekable \
 --deselect=tests/test_tifffile.py::test_read_cfa \
 --deselect=tests/test_tifffile.py::test_read_tiles \
 --deselect=tests/test_tifffile.py::test_write_cfa \
 --deselect=tests/test_tifffile.py::test_write_volume_png
%else
%pyproject_check_import -t
%endif

%files -n python3-%{srcname} -f %{pyproject_files}
%doc README.rst
%{_bindir}/lsm2bin
%{_bindir}/tifffile
%{_bindir}/tiff2fsspec
%{_bindir}/tiffcomment

%changelog
## START: Generated by rpmautospec
* Fri Dec 13 2024 Packit <hello@packit.dev> - 2024.12.12-1
- Update to 2024.12.12 upstream release
- Resolves: rhbz#2332219

* Fri Sep 20 2024 Packit <hello@packit.dev> - 2024.9.20-1
- Update to 2024.9.20 upstream release
- Resolves: rhbz#2313830

* Mon Sep 02 2024 Packit <hello@packit.dev> - 2024.8.30-1
- Update to 2024.8.30 upstream release
- Resolves: rhbz#2309130

* Wed Aug 28 2024 Packit <hello@packit.dev> - 2024.8.28-1
- Update to 2024.8.28 upstream release
- Resolves: rhbz#2307806

* Tue Aug 20 2024 Sergio Pascual <sergiopr@fis.ucm.es> - 2024.8.10-1
- New upstream source

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

* Thu Jun 20 2024 Sergio Pascual <sergiopr@fis.ucm.es> - 2024.6.18-1
- New upstream 2024.6.18

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

* Wed May 15 2024 Sergio Pascual <sergiopr@fis.ucm.es> - 2024.5.3-1
- New upstream release 2025.5.3

* Fri Apr 26 2024 Sergio Pascual <sergiopr@fis.ucm.es> - 2024.4.24-1
- New upstream source 2024.4.24

* Mon Feb 26 2024 Sergio Pascual <sergiopr@fis.ucm.es> - 2024.2.12-1
- New upstream source 2024.2.12

* Thu Feb 01 2024 Sergio Pascual <sergiopr@fis.ucm.es> - 2024.1.30-1
- New upstream source

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

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

* Wed Jan 03 2024 Sergio Pascual <sergiopr@fis.ucm.es> - 2023.12.9-1
- Update to new release 2023.12.9

* Fri Sep 29 2023 Sergio Pascual <sergiopr@fis.ucm.es> - 2023.9.26-1
- New upstream 2023.9.26

* Mon Sep 04 2023 Sergio Pascual <sergiopr@fis.ucm.es> - 2023.8.30-1
- New upstream source 2023.8.30

* Mon Aug 28 2023 Sergio Pascual <sergiopr@fis.ucm.es> - 2023.8.25-1
- New upstream source 2023.8.25

* Sun Jul 23 2023 Sergio Pascual <sergiopr@fis.ucm.es> - 2023.7.18-1
- New upstream source 2023.7.18

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

* Tue Jul 11 2023 Sergio Pascual <sergiopr@fis.ucm.es> - 2023.7.10-1
- New upstream source 2023.7.10

* Mon Jul 10 2023 Sergio Pascual <sergiopr@fis.ucm.es> - 2023.4.12-1
- New upstream source 2023.4.12

* Tue Jun 13 2023 Python Maint <python-maint@redhat.com> - 2020.7.4-10
- Rebuilt for Python 3.12

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

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

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

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

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

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

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

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

* Tue Jul 14 2020 Sergio Pascual <sergiopr@fis.ucm.es> - 2020.7.4-1
- Initial import (#1854975).
## END: Generated by rpmautospec