From 0bb3e57c4da1bab61d5ce64c239bea3f2d1bba055205edca3c7e20d2bb4c4d83 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Tue, 4 Oct 2016 10:59:41 +0000 Subject: [PATCH] Accepting request 432113 from home:badshah400:freetype27 - Add python-Pillow-tests-update-epsilon-for-freetype27.patch: Fix buildfailures against freetype 2.7 by increasing the epsilon (gh#python-pillow/Pillow#2116); this seems to be the recommended solution by upstream. OBS-URL: https://build.opensuse.org/request/show/432113 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Pillow?expand=0&rev=53 --- ...-tests-update-epsilon-for-freetype27.patch | 59 +++++++++++++++++++ python-Pillow.changes | 8 +++ python-Pillow.spec | 3 + 3 files changed, 70 insertions(+) create mode 100644 python-Pillow-tests-update-epsilon-for-freetype27.patch diff --git a/python-Pillow-tests-update-epsilon-for-freetype27.patch b/python-Pillow-tests-update-epsilon-for-freetype27.patch new file mode 100644 index 0000000..81fc7f5 --- /dev/null +++ b/python-Pillow-tests-update-epsilon-for-freetype27.patch @@ -0,0 +1,59 @@ +Index: Pillow-3.1.1/Tests/test_imagefont.py +=================================================================== +--- Pillow-3.1.1.orig/Tests/test_imagefont.py ++++ Pillow-3.1.1/Tests/test_imagefont.py +@@ -124,7 +124,9 @@ try: + + target = 'Tests/images/rectangle_surrounding_text.png' + target_img = Image.open(target) +- self.assert_image_similar(im, target_img, .5) ++ # Original epsilon=0.5 causes the test to fail with freetype >= 2.7 ++ # Setting it to ~2.5 fixes this failure ++ self.assert_image_similar(im, target_img, 2.5) + + def test_render_multiline(self): + im = Image.new(mode='RGB', size=(300, 100)) +@@ -143,7 +145,9 @@ try: + # some versions of freetype have different horizontal spacing. + # setting a tight epsilon, I'm showing the original test failure + # at epsilon = ~38. +- self.assert_image_similar(im, target_img, .5) ++ # Original epsilon=0.5 causes the test to fail with freetype >= 2.7 ++ # Setting it to ~6.5 fixes this failure ++ self.assert_image_similar(im, target_img, 6.2) + + def test_render_multiline_text(self): + ttf = ImageFont.truetype(FONT_PATH, FONT_SIZE) +@@ -157,7 +161,9 @@ try: + target = 'Tests/images/multiline_text.png' + target_img = Image.open(target) + +- self.assert_image_similar(im, target_img, .5) ++ # Original epsilon=0.5 causes the test to fail with freetype >= 2.7 ++ # Setting it to ~6.5 fixes this failure ++ self.assert_image_similar(im, target_img, 6.2) + + # Test align center and right + for align, ext in {"center": "_center", +@@ -169,7 +175,9 @@ try: + target = 'Tests/images/multiline_text'+ext+'.png' + target_img = Image.open(target) + +- self.assert_image_similar(im, target_img, .5) ++ # Original epsilon=0.5 causes the test to fail with freetype >= 2.7 ++ # Setting it to ~6.5 fixes this failure ++ self.assert_image_similar(im, target_img, 6.2) + + def test_unknown_align(self): + im = Image.new(mode='RGB', size=(300, 100)) +@@ -210,7 +218,9 @@ try: + target = 'Tests/images/multiline_text_spacing.png' + target_img = Image.open(target) + +- self.assert_image_similar(im, target_img, .5) ++ # Original epsilon=0.5 causes the test to fail with freetype >= 2.7 ++ # Setting it to ~6.5 fixes this failure ++ self.assert_image_similar(im, target_img, 6.2) + + def test_rotated_transposed_font(self): + img_grey = Image.new("L", (100, 100)) diff --git a/python-Pillow.changes b/python-Pillow.changes index f549b4c..d8c2428 100644 --- a/python-Pillow.changes +++ b/python-Pillow.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Thu Sep 29 01:13:38 UTC 2016 - badshah400@gmail.com + +- Add python-Pillow-tests-update-epsilon-for-freetype27.patch: Fix + buildfailures against freetype 2.7 by increasing the epsilon + (gh#python-pillow/Pillow#2116); this seems to be the recommended + solution by upstream. + ------------------------------------------------------------------- Mon May 23 00:16:32 CEST 2016 - ro@suse.de diff --git a/python-Pillow.spec b/python-Pillow.spec index 24c954f..7f14b49 100644 --- a/python-Pillow.spec +++ b/python-Pillow.spec @@ -24,6 +24,8 @@ License: HPND Group: Development/Languages/Python Url: http://python-imaging.github.io/ Source: https://pypi.python.org/packages/source/P/Pillow/Pillow-%{version}.tar.gz +# PATCH-FIX-UPSTREAM python-Pillow-tests-update-epsilon-for-freetype27.patch gh#python-pillow/Pillow#2116 badshah400@gmail.com -- Fix buildfailures against freetype 2.7 by increasing the epsilon +Patch0: python-Pillow-tests-update-epsilon-for-freetype27.patch BuildRequires: python-devel BuildRequires: python-setuptools BuildRequires: python-tk @@ -91,6 +93,7 @@ Python Imaging Library by Fredrik Lundh and Contributors. %prep %setup -q -n Pillow-%{version} +%patch0 -p1 %build # no need to build it here, as setup.py install will build it again, anyway