From 2962eb6cba4ce75e1d0ac781f12b1648518aab30 Mon Sep 17 00:00:00 2001 From: Philipp David Date: Sat, 18 Nov 2023 09:53:27 +0100 Subject: [PATCH] img2pdf: update to 0.5.0. --- srcpkgs/img2pdf/patches/00_fix_tests.patch | 84 +++++++++++++++++++ .../patches/01_disable_broken_tests.patch | 35 ++++++++ .../patches/0_fix_color_profile_path.patch | 15 ---- srcpkgs/img2pdf/template | 9 +- 4 files changed, 124 insertions(+), 19 deletions(-) create mode 100644 srcpkgs/img2pdf/patches/00_fix_tests.patch create mode 100644 srcpkgs/img2pdf/patches/01_disable_broken_tests.patch delete mode 100644 srcpkgs/img2pdf/patches/0_fix_color_profile_path.patch diff --git a/srcpkgs/img2pdf/patches/00_fix_tests.patch b/srcpkgs/img2pdf/patches/00_fix_tests.patch new file mode 100644 index 0000000000000..13f8c4b19f31f --- /dev/null +++ b/srcpkgs/img2pdf/patches/00_fix_tests.patch @@ -0,0 +1,84 @@ +# source: +# https://salsa.debian.org/debian/img2pdf/-/blob/4a7dbda0f473f7c5ffcaaf68ea4ad3f435e0920d/debian/patches/fix_tests.patch +--- a/src/img2pdf_test.py ++++ b/src/img2pdf_test.py +@@ -85,7 +85,6 @@ for prog in ["convert", "compare", "iden + globals()[prog.upper()] = ["magick", prog] + + HAVE_IMAGEMAGICK_MODERN = True +-HAVE_EXACT_CMYK8 = True + try: + ver = subprocess.check_output(CONVERT + ["-version"], stderr=subprocess.STDOUT) + m = re.fullmatch( +@@ -93,18 +92,13 @@ try: + ) + if m is None: + HAVE_IMAGEMAGICK_MODERN = False +- HAVE_EXACT_CMYK8 = False + else: + if parse_version(m.group(1)) < parse_version("6.9.10-12"): + HAVE_IMAGEMAGICK_MODERN = False +- if parse_version(m.group(1)) < parse_version("7.1.0-48"): +- HAVE_EXACT_CMYK8 = False + except FileNotFoundError: + HAVE_IMAGEMAGICK_MODERN = False +- HAVE_EXACT_CMYK8 = False + except subprocess.CalledProcessError: + HAVE_IMAGEMAGICK_MODERN = False +- HAVE_EXACT_CMYK8 = False + + if not HAVE_IMAGEMAGICK_MODERN: + warnings.warn("imagemagick >= 6.9.10-12 not available, skipping certain checks...") +@@ -351,9 +345,7 @@ def write_png(data, path, bitdepth, colo + + def compare(im1, im2, exact, icc, cmyk): + if exact: +- if cmyk and not HAVE_EXACT_CMYK8: +- raise Exception("cmyk cannot be exact before ImageMagick 7.1.0-48") +- elif icc: ++ if icc: + raise Exception("icc cannot be exact") + else: + subprocess.check_call( +@@ -5562,11 +5554,9 @@ def test_jpg_rot(tmp_path_factory, jpg_r + ) + def test_jpg_cmyk(tmp_path_factory, jpg_cmyk_img, jpg_cmyk_pdf): + tmpdir = tmp_path_factory.mktemp("jpg_cmyk") +- compare_ghostscript( +- tmpdir, jpg_cmyk_img, jpg_cmyk_pdf, gsdevice="tiff32nc", exact=HAVE_EXACT_CMYK8 +- ) ++ compare_ghostscript(tmpdir, jpg_cmyk_img, jpg_cmyk_pdf, gsdevice="tiff32nc") + # not testing with poppler as it cannot write CMYK images +- compare_mupdf(tmpdir, jpg_cmyk_img, jpg_cmyk_pdf, exact=HAVE_EXACT_CMYK8, cmyk=True) ++ compare_mupdf(tmpdir, jpg_cmyk_img, jpg_cmyk_pdf, cmyk=True) + compare_pdfimages_cmyk(tmpdir, jpg_cmyk_img, jpg_cmyk_pdf) + + +@@ -5957,12 +5947,9 @@ def test_tiff_cmyk8(tmp_path_factory, ti + tiff_cmyk8_img, + tiff_cmyk8_pdf, + gsdevice="tiff32nc", +- exact=HAVE_EXACT_CMYK8, + ) + # not testing with poppler as it cannot write CMYK images +- compare_mupdf( +- tmpdir, tiff_cmyk8_img, tiff_cmyk8_pdf, exact=HAVE_EXACT_CMYK8, cmyk=True +- ) ++ compare_mupdf(tmpdir, tiff_cmyk8_img, tiff_cmyk8_pdf, cmyk=True) + compare_pdfimages_tiff(tmpdir, tiff_cmyk8_img, tiff_cmyk8_pdf) + + +@@ -6403,11 +6390,9 @@ def test_tiff_ccitt_nometa2( + ) + def test_miff_cmyk8(tmp_path_factory, miff_cmyk8_img, tiff_cmyk8_img, miff_cmyk8_pdf): + tmpdir = tmp_path_factory.mktemp("miff_cmyk8") +- compare_ghostscript( +- tmpdir, tiff_cmyk8_img, miff_cmyk8_pdf, gsdevice="tiff32nc", exact=False +- ) ++ compare_ghostscript(tmpdir, tiff_cmyk8_img, miff_cmyk8_pdf, gsdevice="tiff32nc") + # not testing with poppler as it cannot write CMYK images +- compare_mupdf(tmpdir, tiff_cmyk8_img, miff_cmyk8_pdf, exact=False, cmyk=True) ++ compare_mupdf(tmpdir, tiff_cmyk8_img, miff_cmyk8_pdf, cmyk=True) + compare_pdfimages_tiff(tmpdir, tiff_cmyk8_img, miff_cmyk8_pdf) + + diff --git a/srcpkgs/img2pdf/patches/01_disable_broken_tests.patch b/srcpkgs/img2pdf/patches/01_disable_broken_tests.patch new file mode 100644 index 0000000000000..ba93066e58b7c --- /dev/null +++ b/srcpkgs/img2pdf/patches/01_disable_broken_tests.patch @@ -0,0 +1,35 @@ +# disable tests apparently affected by ImageMagick regressions. see +# https://gitlab.mister-muffin.de/josch/img2pdf/issues/178 and +# https://github.com/ImageMagick/ImageMagick6/issues/285 for related bug +# reports. +--- a/src/img2pdf_test.py ++++ b/src/img2pdf_test.py +@@ -5590,7 +5590,7 @@ def test_jpg_2000(tmp_path_factory, jpg_2000_img, jpg_2000_pdf): + reason="test utilities not available on Windows and MacOS", + ) + @pytest.mark.skipif( +- not HAVE_JP2, reason="requires imagemagick with support for jpeg2000" ++ True, reason="affected by ImageMagick regressions" + ) + def test_jpg_2000_rgba8(tmp_path_factory, jpg_2000_rgba8_img, jpg_2000_rgba8_pdf): + tmpdir = tmp_path_factory.mktemp("jpg_2000_rgba8") +@@ -5605,7 +5605,7 @@ def test_jpg_2000_rgba8(tmp_path_factory, jpg_2000_rgba8_img, jpg_2000_rgba8_pdf + reason="test utilities not available on Windows and MacOS", + ) + @pytest.mark.skipif( +- not HAVE_JP2, reason="requires imagemagick with support for jpeg2000" ++ True, reason="affected by ImageMagick regressions" + ) + def test_jpg_2000_rgba16(tmp_path_factory, jpg_2000_rgba16_img, jpg_2000_rgba16_pdf): + tmpdir = tmp_path_factory.mktemp("jpg_2000_rgba16") +@@ -6412,8 +6412,8 @@ def test_miff_cmyk8(tmp_path_factory, miff_cmyk8_img, tiff_cmyk8_img, miff_cmyk8 + + + @pytest.mark.skipif( +- sys.platform in ["win32"], +- reason="test utilities not available on Windows and MacOS", ++ True, ++ reason="affected by ImageMagick regressions", + ) + def test_miff_cmyk16( + tmp_path_factory, miff_cmyk16_img, tiff_cmyk16_img, miff_cmyk16_pdf diff --git a/srcpkgs/img2pdf/patches/0_fix_color_profile_path.patch b/srcpkgs/img2pdf/patches/0_fix_color_profile_path.patch deleted file mode 100644 index 009eee3c29816..0000000000000 --- a/srcpkgs/img2pdf/patches/0_fix_color_profile_path.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- a/src/img2pdf.py -+++ b/src/img2pdf.py -@@ -3439,10 +3439,10 @@ RGB.""", - outargs.add_argument( - "--pdfa", - nargs="?", -- const="/usr/share/color/icc/sRGB.icc", -+ const="/usr/share/color/icc/colord/sRGB.icc", - default=None, - help="Output a PDF/A-1b compliant document. By default, this will " -- "embed /usr/share/color/icc/sRGB.icc as the color profile.", -+ "embed /usr/share/color/icc/colord/sRGB.icc as the color profile.", - ) - - sizeargs = parser.add_argument_group( diff --git a/srcpkgs/img2pdf/template b/srcpkgs/img2pdf/template index ec1d99f8bf90a..54d1ccf267b55 100644 --- a/srcpkgs/img2pdf/template +++ b/srcpkgs/img2pdf/template @@ -1,14 +1,15 @@ # Template file for 'img2pdf' pkgname=img2pdf -version=0.4.4 -revision=3 +version=0.5.0 +revision=1 build_style=python3-module hostmakedepends="python3-pikepdf python3-setuptools" depends="colord python3-pdfrw python3-pikepdf python3-Pillow python3-tkinter" +checkdepends="$depends exiftool ghostscript ImageMagick mupdf-tools netpbm + poppler python3-numpy python3-pytest python3-pytest-xdist python3-scipy" short_desc="Lossless conversion of raster images to PDF" maintainer="Philipp David " license="GPL-3.0-or-later" homepage="https://gitlab.mister-muffin.de/josch/img2pdf" distfiles="${PYPI_SITE}/i/img2pdf/img2pdf-${version}.tar.gz" -checksum=8ec898a9646523fd3862b154f3f47cd52609c24cc3e2dc1fb5f0168f0cbe793c -make_check=no # need to patch out some bitdepth checks +checksum=ae6c19731bde2551356c178bf356ca118ac32a232c737a14b423f8039df3c24b