14
0

Accepting request 880532 from home:frispete:python

- Add fix-image-argb.patch to fix image formatting with
  pybind11 >= 2.6.0

OBS-URL: https://build.opensuse.org/request/show/880532
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-python-poppler?expand=0&rev=4
This commit is contained in:
2021-03-22 14:47:10 +00:00
committed by Git OBS Bridge
parent 968ffdf893
commit d7b813ad8e
5 changed files with 28 additions and 18 deletions

View File

@@ -1,15 +0,0 @@
Index: b/tests/test_image.py
===================================================================
--- a/tests/test_image.py
+++ b/tests/test_image.py
@@ -40,8 +40,8 @@ def test_data_size(pdf_page):
def test_image_format_to_str():
- assert str(Image.Format.argb32) == "BGRA"
- assert str(Image.Format.invalid) == ""
+ assert str(Image.Format.argb32) in ("BGRA", "format_enum.argb32")
+ assert str(Image.Format.invalid) in ("", "format_enum.invalid")
def test_image_memory_view(pdf_page):

23
fix-image-argb.patch Normal file
View File

@@ -0,0 +1,23 @@
Index: b/src/cpp/image.cpp
===================================================================
--- a/src/cpp/image.cpp
+++ b/src/cpp/image.cpp
@@ -93,7 +93,11 @@ PYBIND11_MODULE(image, m)
.value("bgr24", image::format_enum::format_bgr24)
#endif
.export_values()
+#if PYBIND11_VERSION_MAJOR >= 2 && PYBIND11_VERSION_MINOR >= 6
+ .def("__str__", &format_to_str, "Image format used by PIL converters.", py::prepend());
+#else
.def("__str__", &format_to_str, "Image format used by PIL converters.");
+#endif
py::class_<image>(m, "image", py::buffer_protocol())
.def(py::init<>())
@@ -114,4 +118,4 @@ PYBIND11_MODULE(image, m)
m.def("supported_image_formats", &image::image::supported_image_formats);
}
-} // namespace poppler
\ No newline at end of file
+} // namespace poppler

View File

@@ -1,7 +1,8 @@
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Mar 22 01:19:20 UTC 2021 - Hans-Peter Jansen <hpj@urpla.net> Mon Mar 22 01:19:20 UTC 2021 - Hans-Peter Jansen <hpj@urpla.net>
- Add fix-image-argb-test.patch to fix image format tests - Add fix-image-argb.patch to fix image formatting with
pybind11 >= 2.6.0
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Oct 6 10:45:50 UTC 2020 - Hans-Peter Jansen <hpj@urpla.net> Tue Oct 6 10:45:50 UTC 2020 - Hans-Peter Jansen <hpj@urpla.net>

View File

@@ -27,8 +27,9 @@ License: GPL-2.0-only
Group: Development/Libraries/Python Group: Development/Libraries/Python
URL: https://github.com/cbrunet/python-poppler URL: https://github.com/cbrunet/python-poppler
Source: python-poppler-%{version}.tar.xz Source: python-poppler-%{version}.tar.xz
Source1: series
Patch: use-system-pybind11.patch Patch: use-system-pybind11.patch
Patch1: fix-image-argb-test.patch Patch1: fix-image-argb.patch
BuildRequires: %{python_module devel} BuildRequires: %{python_module devel}
BuildRequires: %{python_module pybind11-devel} BuildRequires: %{python_module pybind11-devel}
BuildRequires: %{python_module pytest} BuildRequires: %{python_module pytest}

2
series
View File

@@ -1,2 +1,2 @@
use-system-pybind11.patch use-system-pybind11.patch
fix-image-argb-test.patch fix-image-argb.patch