freebsd-ports/textproc/py-ocrmypdf/files/patch-src_ocrmypdf___pipeline.py
Kai Knoblich 2e06ecfc9b textproc/py-ocrmypdf: Update to 16.3.1
* Add a workaround to fallback to graphics/py-pillow-heif if the pi_heif
  module isn't available to enable support for converting HEIF/HEIC
  images.

* Remove no longer needed requirements/workarounds while I'm here, as
  OCRmyPDF requires at least Python 3.10 or newer since version 16.x.

Changelog since 15.4.4:

https://github.com/ocrmypdf/OCRmyPDF/blob/v16.3.1/docs/release_notes.rst

PR:		276310
Reported by:	wen
Co-Authored by:	wen (initial patch for 16.0.4)
MFH:		No (2024Q4 has Python 3.9 as default)
2024-06-15 11:23:34 +02:00

19 lines
464 B
Python

Fallback to pillow_heif if pi_heif is not present.
--- src/ocrmypdf/_pipeline.py.orig 2024-06-15 08:09:59 UTC
+++ src/ocrmypdf/_pipeline.py
@@ -45,8 +45,12 @@ except ImportError:
from pi_heif import register_heif_opener
except ImportError:
- def register_heif_opener():
- pass
+ try:
+ from pillow_heif import register_heif_opener
+ except ImportError:
+
+ def register_heif_opener():
+ pass
T = TypeVar("T")