## 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

Name:           python-pytesseract
Version:        0.3.13
Release:        %autorelease
Summary:        Python-tesseract is a python wrapper for Google's Tesseract-OCR
License:        Apache-2.0
URL:            https://github.com/madmaze/pytesseract
Source0:        %{url}/archive/v%{version}/pytesseract-%{version}.tar.gz

BuildArch:      noarch
BuildRequires:  python3-devel

BuildRequires:  %{py3_dist pytest}
BuildRequires:  tesseract
BuildRequires:  tesseract-langpack-fra
BuildRequires:  tesseract-langpack-eng
BuildRequires:  tesseract-osd

Requires:       tesseract

%global _description %{expand:
Python-tesseract is an optical character recognition (OCR) tool for python. That
is, it will recognize and "read" the text embedded in images.

Python-tesseract is a wrapper for Google's Tesseract-OCR Engine. It is also
useful as a stand-alone invocation script to tesseract, as it can read all image
types supported by the Pillow and Leptonica imaging libraries, including jpeg,
png, gif, bmp, tiff, and others. Additionally, if used as a script,
Python-tesseract will print the recognized text instead of writing it to a file.}

%description %_description

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

%description -n python3-pytesseract %_description

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

%generate_buildrequires
%pyproject_buildrequires

%build
%pyproject_wheel

%install
%pyproject_install
%pyproject_save_files -l pytesseract

sed -i 's|#!/usr/bin/env python|#!/usr/bin/python3|' \
    %{buildroot}%{python3_sitelib}/pytesseract/pytesseract.py
chmod +x %{buildroot}/%{python3_sitelib}/pytesseract/pytesseract.py

%check
%pyproject_check_import
# https://github.com/madmaze/pytesseract/issues/419
%pytest -k 'not test_image_to_string_with_image_type[jpeg2000]'

%files -n python3-pytesseract -f %{pyproject_files}
%{_bindir}/pytesseract

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

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

* Thu May 16 2024 topazus <topazus@outlook.com> - 0.3.13-2
- initial import;rhbz#2280243

* Thu May 16 2024 topazus <topazus@outlook.com> - 0.3.13-1
- initial import; rhbz#2280243
## END: Generated by rpmautospec