commit: bf70b00867498d0dc4ce6c1501c85197a7ca29f9 Author: Pavel Sobolev <contact <AT> paveloom <DOT> dev> AuthorDate: Sun Jan 11 14:35:56 2026 +0000 Commit: Haelwenn Monnier <contact <AT> hacktivis <DOT> me> CommitDate: Sun Jan 11 14:47:40 2026 +0000 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=bf70b008
app-text/frog: new package, add 1.6.0 Signed-off-by: Pavel Sobolev <contact <AT> paveloom.dev> app-text/frog/Manifest | 1 + ...-AppData-file-into-the-metainfo-directory.patch | 17 +++++ ...0-remove-the-AppData-file-validation-test.patch | 22 ++++++ ...g-1.6.0-use-the-system-tessdata-directory.patch | 59 +++++++++++++++ app-text/frog/frog-1.6.0.ebuild | 88 ++++++++++++++++++++++ app-text/frog/metadata.xml | 12 +++ 6 files changed, 199 insertions(+) diff --git a/app-text/frog/Manifest b/app-text/frog/Manifest new file mode 100644 index 0000000000..4fb8c23103 --- /dev/null +++ b/app-text/frog/Manifest @@ -0,0 +1 @@ +DIST frog-1.6.0.tar.gz 13020690 BLAKE2B 4db4f5dca50dd624b7ed05f6f5129b5a21567476a3d1cbc3b3f9823a3907ecbb8a3a258c77d4ecae994686783f1f19c8b621a72606659af12dd9c0deb83628d6 SHA512 e1bda5397a0581b262777d71d30bce3dc3fa4ba9566a76aaa77b07d60a8c62d050499c1895a4a7bbb56f6c0c9fccdb028ec1c0acbaf331c08f644640385f8e67 diff --git a/app-text/frog/files/frog-1.6.0-install-the-AppData-file-into-the-metainfo-directory.patch b/app-text/frog/files/frog-1.6.0-install-the-AppData-file-into-the-metainfo-directory.patch new file mode 100644 index 0000000000..da11b4d252 --- /dev/null +++ b/app-text/frog/files/frog-1.6.0-install-the-AppData-file-into-the-metainfo-directory.patch @@ -0,0 +1,17 @@ +From: Pavel Sobolev <[email protected]> +Subject: [PATCH] Install the AppData file into the `metainfo` directory. + +Signed-off-by: Pavel Sobolev <[email protected]> + +--- a/data/meson.build ++++ b/data/meson.build +@@ -25,7 +25,7 @@ appstream_file = i18n.merge_file( + output: 'com.github.tenderowl.frog.appdata.xml', + po_dir: '../po', + install: true, +- install_dir: join_paths(get_option('datadir'), 'appdata') ++ install_dir: join_paths(get_option('datadir'), 'metainfo') + ) + + install_data('com.github.tenderowl.frog.gschema.xml', + diff --git a/app-text/frog/files/frog-1.6.0-remove-the-AppData-file-validation-test.patch b/app-text/frog/files/frog-1.6.0-remove-the-AppData-file-validation-test.patch new file mode 100644 index 0000000000..4fc969e588 --- /dev/null +++ b/app-text/frog/files/frog-1.6.0-remove-the-AppData-file-validation-test.patch @@ -0,0 +1,22 @@ +From: Pavel Sobolev <[email protected]> +Subject: [PATCH] Remove the AppData file validation test. + +Signed-off-by: Pavel Sobolev <[email protected]> + +--- a/data/meson.build ++++ b/data/meson.build +@@ -28,13 +28,6 @@ appstream_file = i18n.merge_file( + install_dir: join_paths(get_option('datadir'), 'appdata') + ) + +-appstream_util = find_program('appstream-util', required: false) +-if appstream_util.found() +- test('Validate appstream file', appstream_util, +- args: ['validate', appstream_file] +- ) +-endif +- + install_data('com.github.tenderowl.frog.gschema.xml', + install_dir: join_paths(get_option('datadir'), 'glib-2.0/schemas') + ) + diff --git a/app-text/frog/files/frog-1.6.0-use-the-system-tessdata-directory.patch b/app-text/frog/files/frog-1.6.0-use-the-system-tessdata-directory.patch new file mode 100644 index 0000000000..d3a003d1d4 --- /dev/null +++ b/app-text/frog/files/frog-1.6.0-use-the-system-tessdata-directory.patch @@ -0,0 +1,59 @@ +From: Pavel Sobolev <[email protected]> +Subject: [PATCH] Use the system `tessdata` directory. + +Signed-off-by: Pavel Sobolev <[email protected]> + +--- a/data/meson.build ++++ b/data/meson.build +@@ -32,11 +32,6 @@ install_data('com.github.tenderowl.frog.gschema.xml', + install_dir: join_paths(get_option('datadir'), 'glib-2.0/schemas') + ) + +-# Default tesseract trained model +-install_data('tessdata/eng.traineddata', +- install_dir: join_paths(get_option('datadir'), 'appdata') +-) +- + compile_schemas = find_program('glib-compile-schemas', required: false) + if compile_schemas.found() + test('Validate schema file', compile_schemas, +--- a/frog/config.py ++++ b/frog/config.py +@@ -35,10 +35,7 @@ RESOURCE_PREFIX = "/com/github/tenderowl/frog" + if not os.getenv('XDG_DATA_HOME'): + os.environ['XDG_DATA_HOME'] = os.path.expanduser('~/.local/share') + +-if not os.path.exists(os.path.join(os.environ['XDG_DATA_HOME'], 'tessdata')): +- os.mkdir(os.path.join(os.environ['XDG_DATA_HOME'], 'tessdata')) +- + tessdata_url = "https://github.com/tesseract-ocr/tessdata/raw/main/" + tessdata_best_url = "https://github.com/tesseract-ocr/tessdata_best/raw/main/" +-tessdata_dir = os.path.join(os.environ['XDG_DATA_HOME'], 'tessdata') ++tessdata_dir = "/usr/share/tessdata" + tessdata_config = f'--tessdata-dir {tessdata_dir} –psm 0 --oem 1' +--- a/frog/language_manager.py ++++ b/frog/language_manager.py +@@ -192,13 +192,6 @@ class LanguageManager(GObject.GObject): + if not os.path.exists(tessdata_dir): + os.mkdir(tessdata_dir) + +- dest_path = os.path.join(tessdata_dir, 'eng.traineddata') +- source_path = pathlib.Path('/app/share/appdata/eng.traineddata') +- if os.path.exists(dest_path): +- return +- +- copyfile(source_path, dest_path) +- + @GObject.Property(type=GObject.TYPE_PYOBJECT) + def active_language(self) -> LanguageItem: + return self._active_language +@@ -229,7 +222,8 @@ class LanguageManager(GObject.GObject): + def get_downloaded_codes(self, force: bool = False) -> List[str]: + if self._need_update_cache or force: + self._downloaded_codes = [os.path.splitext(lang_file)[0] +- for lang_file in os.listdir(tessdata_dir)] ++ for lang_file in os.listdir(tessdata_dir) ++ if lang_file.endswith('.traineddata')] + self._need_update_cache = False + logger.debug(f"Cache downloaded codes: {self._downloaded_codes}") + return sorted(self._downloaded_codes, key=lambda x: self.get_language(x)) diff --git a/app-text/frog/frog-1.6.0.ebuild b/app-text/frog/frog-1.6.0.ebuild new file mode 100644 index 0000000000..c7040cb2af --- /dev/null +++ b/app-text/frog/frog-1.6.0.ebuild @@ -0,0 +1,88 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=no +DISTUTILS_SINGLE_IMPL=1 +PYTHON_COMPAT=( python3_{12..13} ) + +inherit distutils-r1 gnome2-utils meson xdg + +DESCRIPTION="Extract text from any image, video, QR Code and etc." +HOMEPAGE="https://github.com/TenderOwl/Frog" +SRC_URI="https://github.com/TenderOwl/Frog/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz" + +S="${WORKDIR}/Frog-${PV}" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64" +RESTRICT="test" + +RDEPEND=" + dev-libs/glib:2 + dev-libs/libportal + gui-libs/gtk:4 + gui-libs/libadwaita:1 + media-libs/gstreamer:1.0 + x11-libs/libnotify + + || ( + app-text/tessdata_fast + app-text/tessdata_best + app-text/tessdata_legacy + ) + + $(python_gen_cond_dep ' + dev-python/gtts[${PYTHON_USEDEP}] + dev-python/loguru[${PYTHON_USEDEP}] + dev-python/posthog[${PYTHON_USEDEP}] + dev-python/py-nanoid[${PYTHON_USEDEP}] + dev-python/pytesseract[${PYTHON_USEDEP}] + dev-python/pyzbar[${PYTHON_USEDEP}] + ') +" +DEPEND="${RDEPEND}" +BDEPEND=" + dev-libs/appstream-glib + dev-libs/glib:2 + dev-util/blueprint-compiler + dev-util/desktop-file-utils + dev-util/gtk-update-icon-cache + sys-devel/gettext +" + +PATCHES=( + "${FILESDIR}/${PN}-1.6.0-install-the-AppData-file-into-the-metainfo-directory.patch" + "${FILESDIR}/${PN}-1.6.0-remove-the-AppData-file-validation-test.patch" + "${FILESDIR}/${PN}-1.6.0-use-the-system-tessdata-directory.patch" +) + +distutils_enable_tests import-check + +python_test() { + epytest --import-check frog +} + +src_test() { + meson_src_test + distutils-r1_src_test +} + +src_install() { + meson_src_install + + python_fix_shebang "${ED}/usr/bin" + python_optimize +} + +pkg_postinst() { + xdg_pkg_postinst + gnome2_schemas_update +} + +pkg_postrm() { + xdg_pkg_postrm + gnome2_schemas_update +} diff --git a/app-text/frog/metadata.xml b/app-text/frog/metadata.xml new file mode 100644 index 0000000000..c1a8ce7e98 --- /dev/null +++ b/app-text/frog/metadata.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <name>Pavel Sobolev</name> + <email>[email protected]</email> + </maintainer> + <upstream> + <bugs-to>https://github.com/TenderOwl/Frog/issues</bugs-to> + <remote-id type="github">TenderOwl/Frog</remote-id> + </upstream> +</pkgmetadata>
