3 # - tests fail: raise RuntimeError('Failed to initialize API')
6 %bcond_with tests # do not perform "make test"
7 %bcond_without python2 # CPython 2.x module
8 %bcond_without python3 # CPython 3.x module
10 %define module tesserocr
11 %define egg_name tesserocr
12 %define pypi_name tesserocr
13 Summary: A simple, Pillow-friendly, Python wrapper around tesseract-ocr API using Cython
14 Name: python-%{pypi_name}
18 Group: Libraries/Python
19 Source0: https://files.pythonhosted.org/packages/source/t/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
20 # Source0-md5: 99e2001affe861ae3a5aa2e9f233e2d7
21 Patch0: tesseract4.patch
22 URL: https://github.com/sirfz/tesserocr
23 BuildRequires: rpm-pythonprov
24 BuildRequires: rpmbuild(macros) >= 1.714
25 BuildRequires: tesseract-devel >= 3.04
27 BuildRequires: python-Cython
28 BuildRequires: python-devel
29 BuildRequires: python-pillow
30 BuildRequires: python-setuptools
33 BuildRequires: python3-Cython
34 BuildRequires: python3-devel
35 BuildRequires: python3-pillow
36 BuildRequires: python3-setuptools
38 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
41 tesserocr integrates directly with Tesseract's C++ API using Cython
42 which allows for a simple Pythonic and easy-to-read source code. It
43 enables real concurrent execution when used with Python's threading
44 module by releasing the GIL while processing an image in tesseract.
46 tesserocr is designed to be Pillow-friendly but can also be used with
49 %package -n python3-%{pypi_name}
50 Summary: A simple, Pillow-friendly, Python wrapper around tesseract-ocr API using Cython
51 Group: Libraries/Python
53 %description -n python3-%{pypi_name}
54 tesserocr integrates directly with Tesseract's C++ API using Cython
55 which allows for a simple Pythonic and easy-to-read source code. It
56 enables real concurrent execution when used with Python's threading
57 module by releasing the GIL while processing an image in tesseract.
59 tesserocr is designed to be Pillow-friendly but can also be used with
63 %setup -q -n %{pypi_name}-%{version}
66 # Remove bundled egg-info
67 %{__rm} -r %{egg_name}.egg-info
71 %py_build %{?with_tests:test}
75 %py3_build %{?with_tests:test}
79 rm -rf $RPM_BUILD_ROOT
90 rm -rf $RPM_BUILD_ROOT
94 %defattr(644,root,root,755)
96 %attr(755,root,root) %{py_sitedir}/%{module}.so
97 %{py_sitedir}/%{egg_name}-%{version}-py*.egg-info
101 %files -n python3-%{pypi_name}
102 %defattr(644,root,root,755)
104 %attr(755,root,root) %{py3_sitedir}/%{module}.*.so
105 %{py3_sitedir}/%{egg_name}-%{version}-py*.egg-info