Blob Blame Raw
%global srcname paperwork

Name:           %{srcname}
Version:        1.2.4
Release:        3%{?dist}
Summary:        Using scanner and OCR to grep dead trees the easy way

License:        GPLv3+
URL:            https://github.com/openpaperwork/paperwork
Source0:        %pypi_source
# https://gitlab.gnome.org/World/OpenPaperwork/paperwork/merge_requests/794
Patch0001:      0001-Don-t-print-anything-in-setup-if-quiet.patch
# https://gitlab.gnome.org/World/OpenPaperwork/paperwork/merge_requests/785
Patch0002:      a08bb86c9b4b84e9989fe5981fef51d4cdd3f7f3.patch
# https://gitlab.gnome.org/World/OpenPaperwork/paperwork/merge_requests/801
Patch0003:      0001-Install-icons-to-correct-hicolor-subdirectory.patch
Patch0004:      0002-Drop-extra-icon-dirs.patch

BuildArch:      noarch

BuildRequires:  desktop-file-utils
BuildRequires:  libappstream-glib
BuildRequires:  python3-devel
BuildRequires:  python3dist(setuptools)

Requires:       hicolor-icon-theme
Requires:       python3-%{srcname} = %{version}-%{release}

%global _description %{expand: \
Paperwork is a personal document manager. It manages scanned documents and PDFs.

It's designed to be easy and fast to use. The idea behind Paperwork is "scan &
forget": You can just scan a new document and forget about it until the day you
need it again.

In other words, let the machine do most of the work for you.
}

%description %{_description}


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

BuildRequires:  python3dist(paperwork-backend) >= 1.2.4
BuildRequires:  python3dist(pillow)
BuildRequires:  python3dist(pycountry)
BuildRequires:  python3dist(pyinsane2)
BuildRequires:  python3dist(pyocr) >= 0.3.0
BuildRequires:  python3dist(pypillowfight)
BuildRequires:  python3dist(python-dateutil)
BuildRequires:  python3dist(python-levenshtein)
BuildRequires:  python3dist(pyxdg) >= 0.25
BuildRequires:  python3dist(setuptools)
BuildRequires:  python3dist(termcolor)
BuildRequires:  python3-gobject
BuildRequires:  gtk3
BuildRequires:  gnome-icon-theme
BuildRequires:  gnome-icon-theme-symbolic
BuildRequires:  libnotify
BuildRequires:  tesseract
BuildRequires:  /usr/bin/xvfb-run

# Fallback to old orientation heuristic just freezes, so ensure this is
# available.
Requires:       tesseract-osd

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


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

# Remove bundled egg-info
rm -rf %{srcname}.egg-info

# Remove spurious executable bit and shebangs.
sed -i -e '/^#!\//, 1d' src/%{srcname}/{,frontend/,frontend/import/,frontend/util/}__init__.py
sed -i -e '/^#!\//, 1d' src/%{srcname}/{deps,paperwork}.py


%build
%py3_build


%install
%py3_install

PYTHONPATH=%{buildroot}%{python3_sitelib} \
    paperwork-shell install_system %{buildroot}%{_datadir}/icons %{buildroot}%{_datadir}

%find_lang %{srcname}


%check
paperwork-shell -b chkdeps paperwork_backend
PYTHONPATH=%{buildroot}%{python3_sitelib} \
    xvfb-run -a paperwork-shell -b chkdeps paperwork

desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/*.appdata.xml


%files
%{_bindir}/paperwork
%{_datadir}/applications/*.desktop
%{_datadir}/icons/hicolor/*/apps/*
%{_metainfodir}/*.appdata.xml

%files -n python3-%{srcname} -f %{name}.lang
%doc README.markdown
%{python3_sitelib}/%{srcname}
%{python3_sitelib}/%{srcname}-%{version}-py?.?.egg-info


%changelog
* Thu May 16 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.2.4-3
- Require tesseract-osd so orientation detection doesn't freeze

* Tue Mar 26 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.2.4-2
- Fix icon installation

* Mon Mar 25 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.2.4-1
- Initial package.