mirror of
https://github.com/gentoo-mirror/guru.git
synced 2026-04-07 03:10:15 -04:00
app-text/frog: new package, add 1.6.0
Signed-off-by: Pavel Sobolev <contact@paveloom.dev>
This commit is contained in:
1
app-text/frog/Manifest
Normal file
1
app-text/frog/Manifest
Normal file
@@ -0,0 +1 @@
|
||||
DIST frog-1.6.0.tar.gz 13020690 BLAKE2B 4db4f5dca50dd624b7ed05f6f5129b5a21567476a3d1cbc3b3f9823a3907ecbb8a3a258c77d4ecae994686783f1f19c8b621a72606659af12dd9c0deb83628d6 SHA512 e1bda5397a0581b262777d71d30bce3dc3fa4ba9566a76aaa77b07d60a8c62d050499c1895a4a7bbb56f6c0c9fccdb028ec1c0acbaf331c08f644640385f8e67
|
||||
@@ -0,0 +1,17 @@
|
||||
From: Pavel Sobolev <contact@paveloom.dev>
|
||||
Subject: [PATCH] Install the AppData file into the `metainfo` directory.
|
||||
|
||||
Signed-off-by: Pavel Sobolev <contact@paveloom.dev>
|
||||
|
||||
--- 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',
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
From: Pavel Sobolev <contact@paveloom.dev>
|
||||
Subject: [PATCH] Remove the AppData file validation test.
|
||||
|
||||
Signed-off-by: Pavel Sobolev <contact@paveloom.dev>
|
||||
|
||||
--- 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')
|
||||
)
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
From: Pavel Sobolev <contact@paveloom.dev>
|
||||
Subject: [PATCH] Use the system `tessdata` directory.
|
||||
|
||||
Signed-off-by: Pavel Sobolev <contact@paveloom.dev>
|
||||
|
||||
--- 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))
|
||||
88
app-text/frog/frog-1.6.0.ebuild
Normal file
88
app-text/frog/frog-1.6.0.ebuild
Normal file
@@ -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
|
||||
}
|
||||
12
app-text/frog/metadata.xml
Normal file
12
app-text/frog/metadata.xml
Normal file
@@ -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>contact@paveloom.dev</email>
|
||||
</maintainer>
|
||||
<upstream>
|
||||
<bugs-to>https://github.com/TenderOwl/Frog/issues</bugs-to>
|
||||
<remote-id type="github">TenderOwl/Frog</remote-id>
|
||||
</upstream>
|
||||
</pkgmetadata>
|
||||
Reference in New Issue
Block a user