From 968ffdf8938efebff31df4e821bd2c67a5b7d9a12fe3016c0245bc6b1c00dbaf Mon Sep 17 00:00:00 2001 From: Hans-Peter Jansen Date: Mon, 22 Mar 2021 01:35:42 +0000 Subject: [PATCH 1/2] Accepting request 880432 from home:frispete:python - Add fix-image-argb-test.patch to fix image format tests OBS-URL: https://build.opensuse.org/request/show/880432 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-python-poppler?expand=0&rev=3 --- fix-image-argb-test.patch | 15 +++++++++++++++ python-python-poppler.changes | 5 +++++ python-python-poppler.spec | 9 +++++---- series | 2 ++ 4 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 fix-image-argb-test.patch create mode 100644 series diff --git a/fix-image-argb-test.patch b/fix-image-argb-test.patch new file mode 100644 index 0000000..dd7eca7 --- /dev/null +++ b/fix-image-argb-test.patch @@ -0,0 +1,15 @@ +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): diff --git a/python-python-poppler.changes b/python-python-poppler.changes index 6885771..9b0a46a 100644 --- a/python-python-poppler.changes +++ b/python-python-poppler.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Mar 22 01:19:20 UTC 2021 - Hans-Peter Jansen + +- Add fix-image-argb-test.patch to fix image format tests + ------------------------------------------------------------------- Tue Oct 6 10:45:50 UTC 2020 - Hans-Peter Jansen diff --git a/python-python-poppler.spec b/python-python-poppler.spec index 68fc544..355d7f5 100644 --- a/python-python-poppler.spec +++ b/python-python-poppler.spec @@ -1,7 +1,7 @@ # # spec file for package python-python-poppler # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # Copyright (c) 2020 LISA GmbH ,Bingen, Germany # # All modifications and additions to the file contributed by third parties @@ -28,16 +28,17 @@ Group: Development/Libraries/Python URL: https://github.com/cbrunet/python-poppler Source: python-poppler-%{version}.tar.xz Patch: use-system-pybind11.patch -BuildRequires: python3 +Patch1: fix-image-argb-test.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module pybind11-devel} BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools} -BuildRequires: pkg-config BuildRequires: c++_compiler BuildRequires: cmake BuildRequires: fdupes +BuildRequires: pkg-config BuildRequires: python-rpm-macros +BuildRequires: python3 BuildRequires: pkgconfig(poppler) # some tests require this this BuildRequires: poppler-data @@ -72,7 +73,7 @@ export CXXFLAGS="%{optflags}" %files %{python_files} %license LICENSE.txt -%doc README.md +%doc README.md %{python_sitearch}/ %changelog diff --git a/series b/series new file mode 100644 index 0000000..8eb4d9b --- /dev/null +++ b/series @@ -0,0 +1,2 @@ +use-system-pybind11.patch +fix-image-argb-test.patch From d7b813ad8e9d5dc844ba42da8288ecc101486d66dedf850e07b45d6d0bd8fbad Mon Sep 17 00:00:00 2001 From: Hans-Peter Jansen Date: Mon, 22 Mar 2021 14:47:10 +0000 Subject: [PATCH 2/2] 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 --- fix-image-argb-test.patch | 15 --------------- fix-image-argb.patch | 23 +++++++++++++++++++++++ python-python-poppler.changes | 3 ++- python-python-poppler.spec | 3 ++- series | 2 +- 5 files changed, 28 insertions(+), 18 deletions(-) delete mode 100644 fix-image-argb-test.patch create mode 100644 fix-image-argb.patch diff --git a/fix-image-argb-test.patch b/fix-image-argb-test.patch deleted file mode 100644 index dd7eca7..0000000 --- a/fix-image-argb-test.patch +++ /dev/null @@ -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): diff --git a/fix-image-argb.patch b/fix-image-argb.patch new file mode 100644 index 0000000..aa3d66c --- /dev/null +++ b/fix-image-argb.patch @@ -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_(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 diff --git a/python-python-poppler.changes b/python-python-poppler.changes index 9b0a46a..3745fd5 100644 --- a/python-python-poppler.changes +++ b/python-python-poppler.changes @@ -1,7 +1,8 @@ ------------------------------------------------------------------- Mon Mar 22 01:19:20 UTC 2021 - Hans-Peter Jansen -- 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 diff --git a/python-python-poppler.spec b/python-python-poppler.spec index 355d7f5..3c93cf2 100644 --- a/python-python-poppler.spec +++ b/python-python-poppler.spec @@ -27,8 +27,9 @@ License: GPL-2.0-only Group: Development/Libraries/Python URL: https://github.com/cbrunet/python-poppler Source: python-poppler-%{version}.tar.xz +Source1: series Patch: use-system-pybind11.patch -Patch1: fix-image-argb-test.patch +Patch1: fix-image-argb.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module pybind11-devel} BuildRequires: %{python_module pytest} diff --git a/series b/series index 8eb4d9b..0448890 100644 --- a/series +++ b/series @@ -1,2 +1,2 @@ use-system-pybind11.patch -fix-image-argb-test.patch +fix-image-argb.patch