File paperwork.spec of Package paperwork
#
# spec file for package paperwork
#
# Copyright (c) 2026 Boian Berberov
#
# 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/
#
%{?sle15_python_module_pythons}
Name: paperwork
Version: 2.2.5
Release: 0%{?dist}
Summary: Personal document manager
License: GPL-3.0-or-later
URL: https://openpaper.work/
Source0: https://gitlab.gnome.org/World/OpenPaperwork/%{name}/-/archive/%{version}/%{name}-%{version}.tar.bz2
Source999: %{name}.rpmlintrc
BuildRequires: fdupes
%if 0%{?is_opensuse}
BuildRequires: gettext-tools
%else
BuildRequires: gettext
%endif
BuildRequires: make
BuildRequires: python-rpm-macros
BuildRequires: /usr/bin/convert
# BUG: Help
# BuildRequires: po4a
# BuildRequires: xvfb-run
BuildRequires: %{python_module base >= 3.10}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools > 45}
BuildRequires: %{python_module setuptools_scm > 8}
%if 0%{?is_opensuse} && 0%{?suse_version} < 1600
BuildRequires: %{python_module wheel}
%endif
# openpaperwork-core
Requires: %{python_module certifi}
Requires: %{python_module cryptography}
Requires: %{python_module distro}
Requires: %{python_module ifaddr}
Requires: %{python_module zeroconf}
# openpaperwork-gtk
# "openpaperwork-core"
Requires: %{python_module gobject}
# paperwork-backend
# "openpaperwork-core"
Requires: %{python_module Pillow}
Requires: %{python_module psutil}
Requires: %{python_module pycountry}
Requires: %{python_module pyocr >= 0.3.0}
Requires: %{python_module pypillowfight >= 0.3.0}
Requires: %{python_module qrcode}
Requires: %{python_module scikit-learn}
Requires: %{python_module Whoosh}
# paperwork-gtk
# "openpaperwork-core"
# "openpaperwork-gtk"
# "paperwork-backend"
# Requires: %%{python_module distro}
# Requires: %%{python_module pycountry}
# Requires: %%{python_module pyocr >= 0.3.0}
Requires: %{python_module pyxdg >= .25}
# paperwork-shell
# "openpaperwork-core"
# "openpaperwork-gtk" # mainly for Poppler (GLib)
# "paperwork-backend"
Requires: %{python_module rich}
Requires: %{python_module rich-pixels}
%if 0%{?fedora}
Requires(post): %{_bindir}/update-alternatives
Requires(postun): %{_bindir}/update-alternatives
%else
Requires(post): update-alternatives
Requires(postun): update-alternatives
%endif
BuildArch: noarch
%python_subpackages
%description
Paperwork will help you sort all your papers by turning them into searchable documents
%prep
%setup -q
# Remove shebang
%__sed -i \
-e '1d' \
paperwork-backend/src/paperwork_backend/model/extra_text.py \
paperwork-backend/src/paperwork_backend/model/thumbnail.py \
%{nil}
# BUG: Authors generation requires git at build-time
%__sed -i \
-e '/\/src\/paperwork_backend\/authors data/d' \
paperwork-backend/Makefile
# BUG: Add versions
for dir in openpaperwork-{core,gtk} paperwork-{backend,shell,gtk}
do
pushd "${dir}"
cat << EOF > PKG-INFO
Metadata-Version: 2.1
Name: ${dir}
Version: %{version}
EOF
popd
done
%build
%make_build l10n_compile
# BUG Cannot run it globally, dependencies
%make_build -C paperwork-gtk/src/paperwork_gtk/icon data
for dir in openpaperwork-{core,gtk} paperwork-{backend,shell,gtk}
do
pushd "${dir}"
%pyproject_wheel
popd
done
%install
for dir in openpaperwork-{core,gtk} paperwork-{backend,shell,gtk}
do
pushd "$dir"
%pyproject_install
popd
done
# NOTE: Don't use %%{name} for filenames with %%python_clone
%python_clone -a %{buildroot}%{_bindir}/paperwork-cli
%python_clone -a %{buildroot}%{_bindir}/paperwork-gtk
%python_clone -a %{buildroot}%{_bindir}/paperwork-json
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%post
# NOTE: Don't use %%{name} for filenames with %%python_install_alternative
%python_install_alternative paperwork-cli paperwork-gtk paperwork-json
%postun
# NOTE: Don't use %%{name} for filenames with %%python_install_alternative
%python_uninstall_alternative paperwork-cli paperwork-gtk paperwork-json
%files %{python_files}
%license LICENSE
# NOTE: Don't use %%{name} for filenames with %%python_alternative
%python_alternative %{_bindir}/paperwork-cli
%python_alternative %{_bindir}/paperwork-gtk
%python_alternative %{_bindir}/paperwork-json
# For noarch packages: sitelib
%{python_sitelib}/*
# %%{python_sitelib}/openpaperwork_core-%%{version}.dist-info/
# %%{python_sitelib}/openpaperwork_core/
# %%{python_sitelib}/openpaperwork_gtk-%%{version}.dist-info/
# %%{python_sitelib}/openpaperwork_gtk/
# %%{python_sitelib}/paperwork_backend-%%{version}.dist-info/
# %%{python_sitelib}/paperwork_backend/
# %%{python_sitelib}/paperwork_gtk-%%{version}.dist-info/
# %%{python_sitelib}/paperwork_gtk/
# %%{python_sitelib}/paperwork_shell-%%{version}.dist-info/
# %%{python_sitelib}/paperwork_shell/
%changelog
* Thu Jan 8 2026 Boian Berberov
- Added changelog for openSUSE Leap 16