File ocrodjvu.spec of Package ocrodjvu

#
# spec file for package ocrodjvu
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


Name:           ocrodjvu
Version:        0.11
Release:        0
Summary:        Wrapper for OCR Systems
License:        GPL-2.0-only
Group:          Productivity/Publishing/Other
URL:            http://jwilk.net/software/ocrodjvu
Source0:        https://github.com/jwilk/%{name}/releases/download/%{version}/%{name}-%{version}.tar.xz
Source1:        https://github.com/jwilk/%{name}/releases/download/%{version}/%{name}-%{version}.tar.xz.asc
Source2:        %{name}.keyring
BuildRequires:  python-setuptools
# Required for tests.
BuildRequires:  djvulibre
BuildRequires:  libxml2
%if 0%{?suse_version} > 1315
BuildRequires:  python2-Pillow
BuildRequires:  python2-PyICU
BuildRequires:  python2-djvulibre
BuildRequires:  python2-html5lib
BuildRequires:  python2-lxml
%else
BuildRequires:  python-PyICU
BuildRequires:  python-argparse
BuildRequires:  python-djvulibre
BuildRequires:  python-html5lib
BuildRequires:  python-imaging
BuildRequires:  python-lxml
%endif
BuildRequires:  python2-nose
# End tests.
Requires:       djvulibre
%if 0%{?suse_version} > 1315
Requires:       python2-djvulibre
Requires:       python2-lxml
Requires:       python2-subprocess32
%else
Requires:       python-argparse
Requires:       python-djvulibre
Requires:       python-lxml
%endif
Recommends:     cuneiform
Recommends:     gocr
Recommends:     ocropus
Recommends:     orcad
%if 0%{?suse_version} > 1315
Recommends:     python2-PyICU
Recommends:     python2-html5lib
%else
Recommends:     python-PyICU
Recommends:     python-html5lib
%endif
Recommends:     tesseract-ocr
BuildArch:      noarch

%description
ocrodjvu is a wrapper for OCR systems, that allows you to perform OCR
on DjVu files.

%prep
%setup -q
# Replace "env" shebang with "python2".
sed -i -e '1 s,#! */usr/bin/env python,#!/usr/bin/python2,' \
    ocrodjvu djvu2hocr hocr2djvused
# Remove '/usr/bin/python' from scripts (rpmlint warnings).
sed -i '/\/usr\/bin\/python/d' lib/logger.py
# Remove an executable bit from example scripts.
chmod -x examples/*

%build

%install
python2 setup.py install \
    --root=%{buildroot} \
    --prefix=%{_prefix}

%check
python2 setup.py test

%files
%license doc/COPYING
%doc doc/changelog doc/credits.txt doc/todo.txt examples/
%{_bindir}/%{name}
%{_bindir}/djvu2hocr
%{_bindir}/hocr2djvused
%{_mandir}/man*/*
%{python_sitelib}/%{name}-%{version}-py%{py_ver}.egg-info
%{python_sitelib}/%{name}/

%changelog
openSUSE Build Service is sponsored by