diff --git a/python/py-Pillow/Portfile b/python/py-Pillow/Portfile index 796f9d46544..c1e512944d5 100644 --- a/python/py-Pillow/Portfile +++ b/python/py-Pillow/Portfile @@ -59,7 +59,7 @@ if {${name} ne ${subport}} { } } else { distname pillow-${version} - patchfiles-append patch-setup.py.diff + patchfiles-append patch-setup.py.diff patch-ImageQt.py.diff build.args-append -C raqm=disable \ -C imagequant=disable \ diff --git a/python/py-Pillow/files/patch-ImageQt.py.diff b/python/py-Pillow/files/patch-ImageQt.py.diff new file mode 100644 index 00000000000..d486c6f5b8c --- /dev/null +++ b/python/py-Pillow/files/patch-ImageQt.py.diff @@ -0,0 +1,24 @@ +--- src/PIL/ImageQt.py ++++ src/PIL/ImageQt.py +@@ -36,6 +36,8 @@ qt_version: str | None + qt_versions = [ + ["6", "PyQt6"], + ["side6", "PySide6"], ++ ["5", "PyQt5"], ++ ["side2", "PySide2"], + ] + + # If a version has already been imported, attempt it first +@@ -53,6 +55,12 @@ for version, qt_module in qt_versions: + QIODevice, + ) + from PySide6.QtGui import QImage, QPixmap, qRgba # type: ignore[assignment] ++ elif qt_module == "PyQt5": ++ from PyQt5.QtCore import QBuffer, QByteArray, QIODevice ++ from PyQt5.QtGui import QImage, QPixmap, qRgba ++ elif qt_module == "PySide2": ++ from PySide2.QtCore import QBuffer, QByteArray, QIODevice ++ from PySide2.QtGui import QImage, QPixmap, qRgba + except (ImportError, RuntimeError): + continue + qt_is_installed = True