diff --git a/srcpkgs/paperwork/patches/Fix4Scipy1.13.0.patch b/srcpkgs/paperwork/patches/Fix4Scipy1.13.0.patch new file mode 100644 index 00000000000..9add28626a2 --- /dev/null +++ b/srcpkgs/paperwork/patches/Fix4Scipy1.13.0.patch @@ -0,0 +1,55 @@ +From abcebfe9714644d4e259e53b10e0e9417b5b864f Mon Sep 17 00:00:00 2001 +From: Jerome Flesch +Date: Sun, 21 Apr 2024 13:31:03 +0200 +Subject: [PATCH] backend/guesswork/labels/sklearn: fix use of + scipy.sparse.hstack() + numpy.zeros() + +Closes #1111 +--- + .../paperwork_backend/guesswork/label/sklearn/__init__.py | 5 +++-- + paperwork-backend/src/paperwork_backend/model/fake.py | 6 ++++++ + 2 files changed, 9 insertions(+), 2 deletions(-) + +diff --git a/paperwork-backend/src/paperwork_backend/guesswork/label/sklearn/__init__.py b/paperwork-backend/src/paperwork_backend/guesswork/label/sklearn/__init__.py +index b2af4350..8633211f 100644 +--- a/paperwork-backend/src/paperwork_backend/guesswork/label/sklearn/__init__.py ++++ b/paperwork-backend/src/paperwork_backend/guesswork/label/sklearn/__init__.py +@@ -191,7 +191,8 @@ class UpdatableVectorizer(object): + ) + if required_padding > 0: + doc_vector = numpy.hstack([ +- doc_vector, numpy.zeros((required_padding,)) ++ doc_vector, ++ numpy.zeros((required_padding,)) + ]) + if sum_features is None: + sum_features = doc_vector +@@ -339,7 +340,7 @@ class Corpus(object): + if required_padding > 0: + doc_vector = scipy.sparse.hstack([ + scipy.sparse.csr_matrix(doc_vector), +- numpy.zeros((required_padding,)) ++ numpy.zeros((1, required_padding)) + ]) + else: + doc_vector = scipy.sparse.csr_matrix(doc_vector) +diff --git a/paperwork-backend/src/paperwork_backend/model/fake.py b/paperwork-backend/src/paperwork_backend/model/fake.py +index 29beae97..f06fe18e 100644 +--- a/paperwork-backend/src/paperwork_backend/model/fake.py ++++ b/paperwork-backend/src/paperwork_backend/model/fake.py +@@ -125,6 +125,12 @@ class Plugin(openpaperwork_core.PluginBase): + if doc['url'] == doc_url: + out.update(doc['labels']) + ++ def doc_has_labels_by_url(self, doc_url): ++ for doc in self.docs: ++ if doc['url'] == doc_url: ++ return True if len(doc["labels"]) > 0 else None ++ return None ++ + def doc_add_label_by_url(self, doc_url, label, color=None): + if color is None: + all_labels = set() +-- +GitLab + diff --git a/srcpkgs/paperwork/template b/srcpkgs/paperwork/template new file mode 100644 index 00000000000..f5df4a5b884 --- /dev/null +++ b/srcpkgs/paperwork/template @@ -0,0 +1,44 @@ +# Template file for 'paperwork' +pkgname=paperwork +version=2.2.2 +revision=1 +short_desc="Personal document manager for scanned documents (and PDFs)" +maintainer="idealist1508 " +license="GPL-3.0-or-later" +homepage="https://www.openpaper.work/" +distfiles="https://gitlab.gnome.org/World/OpenPaperwork/paperwork/-/archive/${version}/paperwork-${version}.tar.bz2" +checksum=006b4f95d9c5665dbcd0cdbd851f7164f0abc5fbf91138157f3768d9cae3ff51 + +python_version=3 +hostmakedepends="gettext which python3-pillowfight python3-build python3-installer python3-setuptools_scm python3-wheel python3-distro python3-psutil python3-numpy python3-scipy python3-scikit-learn python3-pycountry python3-Whoosh python3-xdg python3-pyocr" +depends="libhandy1 poppler-glib python3-distro python3-rich python3-psutil python3-pillowfight python3-gobject python3-numpy python3-scipy python3-scikit-learn python3-distutils-extra python3-pycountry python3-Whoosh python3-xdg python3-fabulous python3-pyocr" + +case $XBPS_TARGET_MACHINE in + x86_64*) depends+=" python3-pillow-simd" ;; + *) depends+=" python3-Pillow" ;; +esac + +export SETUPTOOLS_SCM_PRETEND_VERSION=${version} + +do_build() { + make l10n_compile + + for dir in openpaperwork-{core,gtk} paperwork-{backend,shell,gtk}; do + pushd $dir + python -m build --wheel --no-isolation + popd + done +} + +do_install() { + for dir in openpaperwork-{core,gtk} paperwork-{backend,shell,gtk}; do + pushd $dir + python -m installer --destdir="$DESTDIR" dist/*.whl + popd + done + + PYTHONPATH="$DESTDIR"$(python -c 'import site; print(site.getsitepackages()[0])') \ + "$DESTDIR"/usr/bin/paperwork-gtk install \ + --icon_base_dir="$DESTDIR/usr/share/icons" \ + --data_base_dir="$DESTDIR/usr/share" +}