From a9681c74cad12488e86d06d37812a732719c4c3a Mon Sep 17 00:00:00 2001 From: Leo Famulari Date: Tue, 21 Mar 2017 16:18:59 -0400 Subject: gnu: python-pillow: Fix test failures with freetype-2.7. * gnu/packages/patches/python-pillow-freetype-2.7-test-failure.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/python.scm (python-pillow, python2-pillow)[source]: Use it. --- gnu/local.mk | 1 + .../python-pillow-freetype-2.7-test-failure.patch | 75 ++++++++++++++++++++++ gnu/packages/python.scm | 1 + 3 files changed, 77 insertions(+) create mode 100644 gnu/packages/patches/python-pillow-freetype-2.7-test-failure.patch diff --git a/gnu/local.mk b/gnu/local.mk index 65be56ac47..256682effa 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -867,6 +867,7 @@ dist_patch_DATA = \ %D%/packages/patches/python-pandas-skip-failing-tests.patch \ %D%/packages/patches/python-paste-remove-website-test.patch \ %D%/packages/patches/python-paste-remove-timing-test.patch \ + %D%/packages/patches/python-pillow-freetype-2.7-test-failure.patch \ %D%/packages/patches/python-pygit2-disable-network-tests.patch \ %D%/packages/patches/python-pyopenssl-skip-network-test.patch \ %D%/packages/patches/python-pycrypto-CVE-2013-7459.patch \ diff --git a/gnu/packages/patches/python-pillow-freetype-2.7-test-failure.patch b/gnu/packages/patches/python-pillow-freetype-2.7-test-failure.patch new file mode 100644 index 0000000000..18bc30bc79 --- /dev/null +++ b/gnu/packages/patches/python-pillow-freetype-2.7-test-failure.patch @@ -0,0 +1,75 @@ +Fix some test failures when building with freetype-2.7. + +https://github.com/python-pillow/Pillow/issues/2116 +https://github.com/python-pillow/Pillow/pull/2286 + +Patch copied from upstream source repository: + +https://github.com/python-pillow/Pillow/commit/acf68c835c93ba144f83198306aa7e6082a43f43 + +From acf68c835c93ba144f83198306aa7e6082a43f43 Mon Sep 17 00:00:00 2001 +From: hugovk +Date: Mon, 12 Dec 2016 15:16:43 +0200 +Subject: [PATCH] Increase epsilon for FreeType 2.7 + +--- + Tests/test_imagefont.py | 15 ++++++++++----- + 1 file changed, 10 insertions(+), 5 deletions(-) + +diff --git a/Tests/test_imagefont.py b/Tests/test_imagefont.py +index de89ac92..5207dce3 100644 +--- a/Tests/test_imagefont.py ++++ b/Tests/test_imagefont.py +@@ -125,7 +125,9 @@ try: + + target = 'Tests/images/rectangle_surrounding_text.png' + target_img = Image.open(target) +- self.assert_image_similar(im, target_img, .5) ++ ++ # Epsilon ~.5 fails with FreeType 2.7 ++ self.assert_image_similar(im, target_img, 2.5) + + def test_render_multiline(self): + im = Image.new(mode='RGB', size=(300, 100)) +@@ -144,7 +146,7 @@ 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) ++ self.assert_image_similar(im, target_img, 6.2) + + def test_render_multiline_text(self): + ttf = ImageFont.truetype(FONT_PATH, FONT_SIZE) +@@ -158,7 +160,8 @@ try: + target = 'Tests/images/multiline_text.png' + target_img = Image.open(target) + +- self.assert_image_similar(im, target_img, .5) ++ # Epsilon ~.5 fails with FreeType 2.7 ++ self.assert_image_similar(im, target_img, 6.2) + + # Test that text() can pass on additional arguments + # to multiline_text() +@@ -178,7 +181,8 @@ try: + target = 'Tests/images/multiline_text'+ext+'.png' + target_img = Image.open(target) + +- self.assert_image_similar(im, target_img, .5) ++ # Epsilon ~.5 fails with FreeType 2.7 ++ self.assert_image_similar(im, target_img, 6.2) + + def test_unknown_align(self): + im = Image.new(mode='RGB', size=(300, 100)) +@@ -227,7 +231,8 @@ try: + target = 'Tests/images/multiline_text_spacing.png' + target_img = Image.open(target) + +- self.assert_image_similar(im, target_img, .5) ++ # Epsilon ~.5 fails with FreeType 2.7 ++ self.assert_image_similar(im, target_img, 6.2) + + def test_rotated_transposed_font(self): + img_grey = Image.new("L", (100, 100)) +-- +2.12.0 + diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index 96c4245384..1903247d77 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -4537,6 +4537,7 @@ services for your Python modules and applications.") (origin (method url-fetch) (uri (pypi-uri "Pillow" version)) + (patches (search-patches "python-pillow-freetype-2.7-test-failure.patch")) (sha256 (base32 "0xkv0p1d73gz0a1qaasf0ai4262g8f334j07vd60bjrxs2wr3nmj")))) -- cgit v1.2.3