update dependencies and add test

This commit is contained in:
sudacode 2025-03-13 17:06:50 -07:00
parent 114a98777d
commit 62dceb21c7
Signed by: sudacode
SSH Key Fingerprint: SHA256:lT5C2bB398DcX6daCF/gYFNSTK3y+Du3oTGUnYzfTEw
2 changed files with 49 additions and 15 deletions

View File

@ -1,41 +1,58 @@
# Maintainer: Your Name <youremail@example.com>
# Maintainer: sudacode <suda@sudacode.com>
pkgname=python-manga-ocr
_pkgname=manga_ocr
pkgver=0.1.14
pkgrel=1
pkgdesc="A tool for extracting text from manga images using OCR"
arch=('any')
arch=('x86_64')
url="https://github.com/kha-white/manga-ocr"
license=('MIT')
depends=('python')
license=('Apache-2.0')
makedepends=('python-pip' 'python-installer' 'python-wheel')
depends=(
'python'
'python>=3.6'
'python-fire'
'python-fugashi'
'python-jaconv'
'python-loguru'
'python-numpy'
'python-pillow'
'python-pillow>=10.0.0'
'python-pyperclip'
'python-pytorch'
'python-transformers'
'python-pytorch>=1.0'
'python-transformers>=4.25.0'
'python-unidic-lite'
)
optdepends=('python-pytorch: GPU acceleration')
source=("https://github.com/kha-white/manga_ocr/archive/refs/tags/v${pkgver}.tar.gz")
sha256sums=('f7d73bbf482cbefb6f91ff3c628a3131d6c7dc863612539fe5d03a4b7d640643')
optdepends=(
'python-pytorch: GPU acceleration'
'wl-clipboard: Read images from the clipboard in the command-line mode on Wayland'
'xclip: Read images from the clipbaord in the command-line mode on X11'
)
checkdepends=('python-pytest')
conflicts=('manga-ocr-git')
source=(
"https://github.com/kha-white/manga_ocr/archive/refs/tags/v${pkgver}.tar.gz"
"skip-example-run-on-boot.patch"
)
sha256sums=('f7d73bbf482cbefb6f91ff3c628a3131d6c7dc863612539fe5d03a4b7d640643'
'e0458743eebd9baac05d31031511477c81f20157821becf3d8da1d487df7d9c1')
prepare() {
cd "${_pkgname//_/-}-$pkgver"
patch --forward --strip=0 --input=../skip-example-run-on-boot.patch
}
build() {
cd "${_pkgname//_/-}-$pkgver"
python -m pip wheel . --no-deps --wheel-dir dist
}
check() {
cd "${_pkgname//_/-}-$pkgver"
pytest
}
package() {
cd "${_pkgname//_/-}-$pkgver"
python -m pip install --no-deps --root="$pkgdir" --prefix=/usr --ignore-installed .
# Move the assets folder to the Python module directory
install -dm755 "$pkgdir/usr/lib/python3.13/site-packages/manga_ocr/"
cp -r assets "$pkgdir/usr/lib/python3.13/site-packages/manga_ocr/"
cp "$pkgdir/usr/lib/python3.13/site-packages/manga_ocr/assets/examples/00.jpg" "$pkgdir/usr/lib/python3.13/site-packages/manga_ocr/assets/example.jpg"
}

View File

@ -0,0 +1,17 @@
--- manga_ocr/ocr.py
+++ manga_ocr/ocr-patched.py
@@ -27,10 +27,10 @@
else:
logger.info("Using CPU")
- example_path = Path(__file__).parent / "assets/example.jpg"
- if not example_path.is_file():
- raise FileNotFoundError(f"Missing example image {example_path}")
- self(example_path)
+ # example_path = Path(__file__).parent / "assets/example.jpg"
+ # if not example_path.is_file():
+ # raise FileNotFoundError(f"Missing example image {example_path}")
+ # self(example_path)
logger.info("OCR ready")