py-Pillow: added patch to restore PyQt5 and PySide2 functionality

This commit is contained in:
Andrew Murray
2026-01-17 18:48:42 +11:00
committed by Renee Otten
parent 6aa17fc917
commit 22fb791c40
2 changed files with 25 additions and 1 deletions
+1 -1
View File
@@ -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 \
@@ -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