diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-01-19 14:07:13 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-01-19 14:07:13 -0700 |
commit | d770466fd64d78e04f6c9a1f7faed74e11d6711a (patch) | |
tree | 2e4e27722330ff1c0429ed861e66a7d3c58f0197 | |
parent | 9799cc736eaf10ce6f1ced6fdab3f5154019f9cd (diff) |
Cherry-pick upstream commits 7ac9b058 and fe4b568a
-rw-r--r-- | debian/changelog | 2 | ||||
-rw-r--r-- | debian/patches/Fix-externalize_inline_images-for-qpdf-10.1.0.patch | 25 | ||||
-rw-r--r-- | debian/patches/libqpdf-10.1.0-raises-different-exception.patch | 42 | ||||
-rw-r--r-- | debian/patches/series | 2 |
4 files changed, 71 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog index b0acea2..fdbc78a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,8 @@ pikepdf (1.17.3+dfsg-3) UNRELEASED; urgency=medium * Fix bug number closed by previous upload. + * Cherry-pick upstream commits 7ac9b058 and fe4b568a for compatibility + with qpdf 10.1.0 (Closes: #980426). -- Sean Whitton <spwhitton@spwhitton.name> Sun, 27 Dec 2020 14:43:39 -0700 diff --git a/debian/patches/Fix-externalize_inline_images-for-qpdf-10.1.0.patch b/debian/patches/Fix-externalize_inline_images-for-qpdf-10.1.0.patch new file mode 100644 index 0000000..867e4da --- /dev/null +++ b/debian/patches/Fix-externalize_inline_images-for-qpdf-10.1.0.patch @@ -0,0 +1,25 @@ +From: "James R. Barlow" <james@purplerock.ca> +Date: Mon, 4 Jan 2021 20:21:51 -0800 +Subject: Fix externalize_inline_images for qpdf 10.1.0 + +(cherry picked from commit 7ac9b058104219b26747f3fc9761ac6b3c037402) +--- + src/qpdf/page.cpp | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/qpdf/page.cpp b/src/qpdf/page.cpp +index 72748a9..3f6e26e 100644 +--- a/src/qpdf/page.cpp ++++ b/src/qpdf/page.cpp +@@ -79,7 +79,10 @@ void init_page(py::module& m) + .def("_get_mediabox", &QPDFPageObjectHelper::getMediaBox) + .def("_get_cropbox", &QPDFPageObjectHelper::getCropBox) + .def("_get_trimbox", &QPDFPageObjectHelper::getTrimBox) +- .def("externalize_inline_images", &QPDFPageObjectHelper::externalizeInlineImages, ++ .def("externalize_inline_images", ++ [](QPDFPageObjectHelper &poh, size_t min_size = 0) { ++ return poh.externalizeInlineImages(min_size); ++ }, + py::arg("min_size") = 0, + R"~~~( + Convert inlines image to normal (external) images. diff --git a/debian/patches/libqpdf-10.1.0-raises-different-exception.patch b/debian/patches/libqpdf-10.1.0-raises-different-exception.patch new file mode 100644 index 0000000..e9003cb --- /dev/null +++ b/debian/patches/libqpdf-10.1.0-raises-different-exception.patch @@ -0,0 +1,42 @@ +From: "James R. Barlow" <james@purplerock.ca> +Date: Wed, 6 Jan 2021 00:22:16 -0800 +Subject: libqpdf 10.1.0 raises different exception + +The different errors are acceptable to us; actually they are more +correct than the original behavior. + +(cherry picked from commit fe4b568ac88ba551458578613b013ac17edf5c4e) +--- + tests/test_filters.py | 13 ++++++------- + 1 file changed, 6 insertions(+), 7 deletions(-) + +diff --git a/tests/test_filters.py b/tests/test_filters.py +index b394795..33124bf 100644 +--- a/tests/test_filters.py ++++ b/tests/test_filters.py +@@ -74,19 +74,18 @@ class FilterInvalid(pikepdf.TokenFilter): + + def test_invalid_handle_token(pal): + page = pikepdf.Page(pal.pages[0]) +- with pytest.raises(pikepdf.PdfError): +- result = page.get_filtered_contents(FilterInvalid()) ++ with pytest.raises((TypeError, pikepdf.PdfError)): ++ page.get_filtered_contents(FilterInvalid()) + + + def test_invalid_tokenfilter(pal): + page = pikepdf.Page(pal.pages[0]) + with pytest.raises(TypeError): +- result = page.get_filtered_contents(list()) ++ page.get_filtered_contents(list()) + + + def test_tokenfilter_is_abstract(pal): + page = pikepdf.Page(pal.pages[0]) +- try: +- result = page.get_filtered_contents(pikepdf.TokenFilter()) +- except pikepdf.PdfError: +- assert 'Tried to call pure virtual' in pal.get_warnings()[0] ++ with pytest.raises((RuntimeError, pikepdf.PdfError)): ++ page.get_filtered_contents(pikepdf.TokenFilter()) ++ assert 'Tried to call pure virtual' in pal.get_warnings()[0] diff --git a/debian/patches/series b/debian/patches/series index c138335..0205874 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -3,3 +3,5 @@ drop-installation-from-docs-contents.patch drop-pybind11-from-setup.py.patch drop-save-pike.patch Fix-compatibility-with-pybind11.patch +Fix-externalize_inline_images-for-qpdf-10.1.0.patch +libqpdf-10.1.0-raises-different-exception.patch |