From 8898e0eb6db64bbe1fc8da048c6b55db1d009d76 Mon Sep 17 00:00:00 2001 From: K900 Date: Fri, 9 May 2025 20:35:29 +0300 Subject: [PATCH] python312Packages.python-poppler: patch to fix build with latest Poppler --- .../python-modules/python-poppler/default.nix | 5 ++- .../python-poppler/poppler-25.patch | 39 +++++++++++++++++++ 2 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 pkgs/development/python-modules/python-poppler/poppler-25.patch diff --git a/pkgs/development/python-modules/python-poppler/default.nix b/pkgs/development/python-modules/python-poppler/default.nix index d817dccfae79..d505bf39af50 100644 --- a/pkgs/development/python-modules/python-poppler/default.nix +++ b/pkgs/development/python-modules/python-poppler/default.nix @@ -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 ]; diff --git a/pkgs/development/python-modules/python-poppler/poppler-25.patch b/pkgs/development/python-modules/python-poppler/poppler-25.patch new file mode 100644 index 000000000000..218dc60883f8 --- /dev/null +++ b/pkgs/development/python-modules/python-poppler/poppler-25.patch @@ -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(), 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