python312Packages.python-poppler: patch to fix build with latest Poppler

This commit is contained in:
K900
2025-05-10 16:45:38 +03:00
parent 59c5d6afbd
commit 8898e0eb6d
2 changed files with 42 additions and 2 deletions
@@ -4,10 +4,8 @@
fetchPypi,
pythonOlder,
pytestCheckHook,
setuptools,
meson-python,
ninja,
meson,
poppler,
pkg-config,
pybind11,
@@ -29,6 +27,9 @@ buildPythonPackage rec {
patches = [
# Prevent Meson from downloading pybind11, use system version instead
./use_system_pybind11.patch
# Fix build with Poppler 25.01+
# See: https://github.com/cbrunet/python-poppler/pull/92
./poppler-25.patch
];
build-system = [ meson-python ];
@@ -0,0 +1,39 @@
diff --git a/src/cpp/image.cpp b/src/cpp/image.cpp
index 725359b..91131f4 100644
--- a/src/cpp/image.cpp
+++ b/src/cpp/image.cpp
@@ -102,7 +102,11 @@ PYBIND11_MODULE(image, m)
.def(py::init<int, int, image::format_enum>(), py::arg("iwidth"), py::arg("iheight"), py::arg("iformat"))
.def("bytes_per_row", &image::bytes_per_row)
// .def("const_data", &image::const_data)
+#if HAS_VERSION(25, 1)
+ .def("copy", &image::copy)
+#else
.def("copy", &image::copy, py::arg("rect") = rect())
+#endif
.def("data", &data)
.def("set_data", &set_data)
.def("format", &image::format)
diff --git a/src/poppler/image.py b/src/poppler/image.py
index a8c27e2..0a6834c 100644
--- a/src/poppler/image.py
+++ b/src/poppler/image.py
@@ -16,7 +16,6 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from poppler.cpp import image
-from poppler.rectangle import Rectangle
class Image:
@@ -47,8 +46,8 @@ def bytes_per_row(self):
def const_data(self):
return self._image.data()
- def copy(self, rect=None):
- image = self._image.copy(rect or Rectangle()._rect)
+ def copy(self):
+ image = self._image.copy()
return Image.from_object(image)
@property