Date: Wednesday, November 11, 2020 @ 14:24:24 Author: foutrelis Revision: 750775
Fix tests with pillow 7.2 Change to tarball source so patch doesn't complain about line endings. Depend on libwebp for tests: /usr/lib/python3.9/site-packages/PIL/Image.py:2942: UserWarning: image file could not be identified because WEBP support not installed Added: python-piexif/trunk/pillow-7.2.patch Modified: python-piexif/trunk/PKGBUILD ------------------+ PKGBUILD | 17 +++++++++++++---- pillow-7.2.patch | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 4 deletions(-) Modified: PKGBUILD =================================================================== --- PKGBUILD 2020-11-11 14:08:26 UTC (rev 750774) +++ PKGBUILD 2020-11-11 14:24:24 UTC (rev 750775) @@ -1,5 +1,5 @@ # Maintainer: David Runge <[email protected]> -_name=piexif +_name=Piexif pkgname=python-piexif pkgver=1.1.3 pkgrel=4 @@ -9,10 +9,19 @@ license=('MIT') depends=('python') makedepends=('python-setuptools') -checkdepends=('python-pytest' 'python-pillow' 'python-sphinx') -source=("https://files.pythonhosted.org/packages/source/${_name::1}/${_name}/${_name}-${pkgver}.zip") -sha512sums=('df5f7793c39911af58bbae76cf998e2a7bc820b84dcf9808ee8f6a38f766f824fef28392ef88387e18b10c270c4b27881be310f0368076b6fb65379a11a93270') +checkdepends=('python-pytest' 'python-pillow' 'libwebp' 'python-sphinx') +source=($pkgname-$pkgver.tar.gz::https://github.com/hMatoba/Piexif/archive/$pkgver.tar.gz + pillow-7.2.patch) +sha512sums=('bae3a51603bf46e9a8170db180a298c70c77537cb405582eb53ade2b29907fbaeeb4d890a124e0a54de53077b7631c007be088c690f81fb3eda1cd3ccb1ca0d2' + 'be1ee541e3bb6c219d6fd9ab68e9143c2131f695a2001d36a0d63b0566d71a542a09d58dc0bcbdb8c1353297156ea7853d483b9a44407cb31c30acc4252310bf') +prepare() { + cd "${_name}-${pkgver}" + + # https://github.com/hMatoba/Piexif/issues/108 + patch -Np1 -i ../pillow-7.2.patch +} + build() { cd "${_name}-${pkgver}" python setup.py build Added: pillow-7.2.patch =================================================================== --- pillow-7.2.patch (rev 0) +++ pillow-7.2.patch 2020-11-11 14:24:24 UTC (rev 750775) @@ -0,0 +1,40 @@ +From 5209b53e9689ce28dcd045f384633378d619718f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jan=20Wi=C5=9Bniewski?= <[email protected]> +Date: Thu, 5 Nov 2020 16:18:52 +0100 +Subject: [PATCH] convert IFDRational to tuples in tests + +This fixes tests with Pillow version >= 7.2.0 +--- + tests/s_test.py | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/tests/s_test.py b/tests/s_test.py +index 5d105de..a7cad54 100644 +--- a/tests/s_test.py ++++ b/tests/s_test.py +@@ -9,6 +9,7 @@ + import time + import unittest + ++import PIL + from PIL import Image + import piexif + from piexif import _common, ImageIFD, ExifIFD, GPSIFD, TAGS, InvalidImageDataError +@@ -580,6 +581,17 @@ def test_print_exif(self): + # test utility methods---------------------------------------------- + + def _compare_value(self, v1, v2): ++ if isinstance(v2, PIL.TiffImagePlugin.IFDRational): ++ v2 = (v2.numerator, v2.denominator) ++ if isinstance(v2, tuple): ++ converted_v2 = [] ++ for el in v2: ++ if isinstance(el, PIL.TiffImagePlugin.IFDRational): ++ converted_v2.append((el.numerator, el.denominator)) ++ else: ++ converted_v2.append(el) ++ v2 = tuple(converted_v2) ++ + if type(v1) != type(v2): + if isinstance(v1, tuple): + self.assertEqual(pack_byte(*v1), v2)
