openslide: python part 1.1.1 -> 1.1.2 (required by newer setuptools)
This commit is contained in:
@@ -3,18 +3,16 @@
|
||||
, pillow }:
|
||||
|
||||
buildPythonPackage rec {
|
||||
version = "1.1.1";
|
||||
version = "1.1.2";
|
||||
name = "openslide-python-${version}";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "openslide";
|
||||
repo = "openslide-python";
|
||||
rev = "v${version}";
|
||||
sha256 = "1is8g8vy8s1xgfw8q76gdx8ygwvj56cl0vxfd3lx0iys15wzs7a4";
|
||||
sha256 = "0hjzmpdkii0kmndnix58ngd1fzskypzfc166gf970if0rkdxpqw7";
|
||||
};
|
||||
|
||||
patches = [ ./zero-size-test-skip.patch ];
|
||||
|
||||
postPatch = ''
|
||||
sed -i 's|LoadLibrary('\'''libopenslide.so.0'\''')|LoadLibrary('\'''${openslide}/lib/libopenslide.so.0'\''')|' openslide/lowlevel.py
|
||||
'';
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
From 4ea9211e10e9fc58d04bac909d73a2448c4a44ff Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Gilbert <bgilbert@cs.cmu.edu>
|
||||
Date: Tue, 24 Jan 2017 23:32:36 -0800
|
||||
Subject: [PATCH] tests: Avoid spurious failures with Pillow 3.4.0 - 3.4.2
|
||||
|
||||
---
|
||||
tests/__init__.py | 10 ++++++++++
|
||||
tests/test_imageslide.py | 3 ++-
|
||||
tests/test_openslide.py | 4 +++-
|
||||
3 files changed, 15 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/tests/__init__.py b/tests/__init__.py
|
||||
index cc2b217..d2158b3 100644
|
||||
--- a/tests/__init__.py
|
||||
+++ b/tests/__init__.py
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
from functools import wraps
|
||||
import os
|
||||
+from PIL import Image
|
||||
import unittest
|
||||
|
||||
try:
|
||||
@@ -28,6 +29,15 @@
|
||||
have_optimizations = False
|
||||
|
||||
|
||||
+# PIL.Image cannot have zero width or height on Pillow 3.4.0 - 3.4.2
|
||||
+# https://github.com/python-pillow/Pillow/issues/2259
|
||||
+try:
|
||||
+ Image.new('RGBA', (1, 0))
|
||||
+ image_dimensions_cannot_be_zero = False
|
||||
+except ValueError:
|
||||
+ image_dimensions_cannot_be_zero = True
|
||||
+
|
||||
+
|
||||
def file_path(name):
|
||||
return os.path.join(os.path.dirname(__file__), name)
|
||||
|
||||
diff --git a/tests/test_imageslide.py b/tests/test_imageslide.py
|
||||
index bbde9ec..de2a734 100644
|
||||
--- a/tests/test_imageslide.py
|
||||
+++ b/tests/test_imageslide.py
|
||||
@@ -22,7 +22,7 @@
|
||||
from PIL import Image
|
||||
import unittest
|
||||
|
||||
-from . import file_path
|
||||
+from . import file_path, image_dimensions_cannot_be_zero, skip_if
|
||||
|
||||
# Tests should be written to be compatible with Python 2.6 unittest.
|
||||
|
||||
@@ -104,6 +104,7 @@ def test_read_region(self):
|
||||
self.assertEqual(self.osr.read_region((-10, -10), 0, (400, 400)).size,
|
||||
(400, 400))
|
||||
|
||||
+ @skip_if(image_dimensions_cannot_be_zero, 'Pillow issue #2259')
|
||||
def test_read_region_size_dimension_zero(self):
|
||||
self.assertEqual(self.osr.read_region((0, 0), 0, (400, 0)).size,
|
||||
(400, 0))
|
||||
diff --git a/tests/test_openslide.py b/tests/test_openslide.py
|
||||
index 3350c76..b80e2f5 100644
|
||||
--- a/tests/test_openslide.py
|
||||
+++ b/tests/test_openslide.py
|
||||
@@ -25,7 +25,8 @@
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
-from . import file_path, have_optimizations, skip_if
|
||||
+from . import (file_path, have_optimizations, image_dimensions_cannot_be_zero,
|
||||
+ skip_if)
|
||||
|
||||
# Tests should be written to be compatible with Python 2.6 unittest.
|
||||
|
||||
@@ -110,6 +111,7 @@ def test_read_region(self):
|
||||
self.assertEqual(self.osr.read_region((-10, -10), 1, (400, 400)).size,
|
||||
(400, 400))
|
||||
|
||||
+ @skip_if(image_dimensions_cannot_be_zero, 'Pillow issue #2259')
|
||||
def test_read_region_size_dimension_zero(self):
|
||||
self.assertEqual(self.osr.read_region((0, 0), 1, (400, 0)).size,
|
||||
(400, 0))
|
||||
Reference in New Issue
Block a user