[med-svn] [Git][med-team/openslide-python][upstream] New upstream version 1.1.2
Nilesh Patra
gitlab at salsa.debian.org
Tue Oct 6 15:39:04 BST 2020
Nilesh Patra pushed to branch upstream at Debian Med / openslide-python
Commits:
af4e2a29 by Nilesh Patra at 2020-10-06T19:50:06+05:30
New upstream version 1.1.2
- - - - -
15 changed files:
- CHANGELOG.txt
- LICENSE.txt
- PKG-INFO
- README.rst
- doc/index.rst
- doc/jekyll_fix.py
- openslide/__init__.py
- openslide/_version.py
- openslide/lowlevel.py
- openslide_python.egg-info/PKG-INFO
- setup.cfg
- setup.py
- tests/__init__.py
- tests/test_imageslide.py
- tests/test_openslide.py
Changes:
=====================================
CHANGELOG.txt
=====================================
@@ -1,6 +1,12 @@
Notable Changes in OpenSlide Python
===================================
+Version 1.1.2, 2020-09-13
+ * Fix install with setuptools >= 46
+ * Fix ImportError with Python 3.9
+ * Fix docs build with Sphinx 2.x
+ * Remove --without-performance install option
+
Version 1.1.1, 2016-06-11
* Change default Deep Zoom tile size to 254 pixels
* Fix image reading with Pillow 3.x when installed --without-performance
=====================================
LICENSE.txt
=====================================
@@ -2,7 +2,7 @@ OpenSlide
Carnegie Mellon University
-http://openslide.org/
+https://openslide.org/
====================
=====================================
PKG-INFO
=====================================
@@ -1,10 +1,10 @@
-Metadata-Version: 1.1
+Metadata-Version: 1.2
Name: openslide-python
-Version: 1.1.1
+Version: 1.1.2
Summary: Python interface to OpenSlide
-Home-page: http://openslide.org/
-Author: OpenSlide project
-Author-email: openslide-users at lists.andrew.cmu.edu
+Home-page: https://openslide.org/
+Maintainer: OpenSlide project
+Maintainer-email: openslide-users at lists.andrew.cmu.edu
License: GNU Lesser General Public License, version 2.1
Description: ================
OpenSlide Python
@@ -33,16 +33,16 @@ Description: ================
* Ventana_ (``.bif``, ``.tif``)
* `Generic tiled TIFF`_ (``.tif``)
- .. _OpenSlide: http://openslide.org/
- .. _Aperio: http://openslide.org/formats/aperio/
- .. _Hamamatsu: http://openslide.org/formats/hamamatsu/
- .. _Leica: http://openslide.org/formats/leica/
- .. _MIRAX: http://openslide.org/formats/mirax/
- .. _Philips: http://openslide.org/formats/philips/
- .. _Sakura: http://openslide.org/formats/sakura/
- .. _Trestle: http://openslide.org/formats/trestle/
- .. _Ventana: http://openslide.org/formats/ventana/
- .. _`Generic tiled TIFF`: http://openslide.org/formats/generic-tiff/
+ .. _OpenSlide: https://openslide.org/
+ .. _Aperio: https://openslide.org/formats/aperio/
+ .. _Hamamatsu: https://openslide.org/formats/hamamatsu/
+ .. _Leica: https://openslide.org/formats/leica/
+ .. _MIRAX: https://openslide.org/formats/mirax/
+ .. _Philips: https://openslide.org/formats/philips/
+ .. _Sakura: https://openslide.org/formats/sakura/
+ .. _Trestle: https://openslide.org/formats/trestle/
+ .. _Ventana: https://openslide.org/formats/ventana/
+ .. _`Generic tiled TIFF`: https://openslide.org/formats/generic-tiff/
Requirements
@@ -60,7 +60,7 @@ Description: ================
2. ``pip install openslide-python``
- .. _`Install OpenSlide`: http://openslide.org/download/
+ .. _`Install OpenSlide`: https://openslide.org/download/
Using PIL
@@ -90,9 +90,9 @@ Description: ================
- GitHub_
- `Sample data`_
- .. _`API documentation`: http://openslide.org/api/python/
+ .. _`API documentation`: https://openslide.org/api/python/
.. _Changelog: https://raw.github.com/openslide/openslide-python/master/CHANGELOG.txt
- .. _Website: http://openslide.org/
+ .. _Website: https://openslide.org/
.. _GitHub: https://github.com/openslide/openslide-python
.. _`Sample data`: http://openslide.cs.cmu.edu/download/openslide-testdata/
@@ -116,9 +116,15 @@ Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
+Requires-Python: >=2.6, !=3.0.*, !=3.1.*, !=3.2.*
=====================================
README.rst
=====================================
@@ -25,16 +25,16 @@ OpenSlide can read virtual slides in several formats:
* Ventana_ (``.bif``, ``.tif``)
* `Generic tiled TIFF`_ (``.tif``)
-.. _OpenSlide: http://openslide.org/
-.. _Aperio: http://openslide.org/formats/aperio/
-.. _Hamamatsu: http://openslide.org/formats/hamamatsu/
-.. _Leica: http://openslide.org/formats/leica/
-.. _MIRAX: http://openslide.org/formats/mirax/
-.. _Philips: http://openslide.org/formats/philips/
-.. _Sakura: http://openslide.org/formats/sakura/
-.. _Trestle: http://openslide.org/formats/trestle/
-.. _Ventana: http://openslide.org/formats/ventana/
-.. _`Generic tiled TIFF`: http://openslide.org/formats/generic-tiff/
+.. _OpenSlide: https://openslide.org/
+.. _Aperio: https://openslide.org/formats/aperio/
+.. _Hamamatsu: https://openslide.org/formats/hamamatsu/
+.. _Leica: https://openslide.org/formats/leica/
+.. _MIRAX: https://openslide.org/formats/mirax/
+.. _Philips: https://openslide.org/formats/philips/
+.. _Sakura: https://openslide.org/formats/sakura/
+.. _Trestle: https://openslide.org/formats/trestle/
+.. _Ventana: https://openslide.org/formats/ventana/
+.. _`Generic tiled TIFF`: https://openslide.org/formats/generic-tiff/
Requirements
@@ -52,7 +52,7 @@ Installation
2. ``pip install openslide-python``
-.. _`Install OpenSlide`: http://openslide.org/download/
+.. _`Install OpenSlide`: https://openslide.org/download/
Using PIL
@@ -82,9 +82,9 @@ More Information
- GitHub_
- `Sample data`_
-.. _`API documentation`: http://openslide.org/api/python/
+.. _`API documentation`: https://openslide.org/api/python/
.. _Changelog: https://raw.github.com/openslide/openslide-python/master/CHANGELOG.txt
-.. _Website: http://openslide.org/
+.. _Website: https://openslide.org/
.. _GitHub: https://github.com/openslide/openslide-python
.. _`Sample data`: http://openslide.cs.cmu.edu/download/openslide-testdata/
=====================================
doc/index.rst
=====================================
@@ -28,16 +28,16 @@ OpenSlide can read virtual slides in several formats:
OpenSlide Python is released under the terms of the `GNU Lesser General
Public License, version 2.1`_.
-.. _OpenSlide: http://openslide.org/
-.. _Aperio: http://openslide.org/formats/aperio/
-.. _Hamamatsu: http://openslide.org/formats/hamamatsu/
-.. _Leica: http://openslide.org/formats/leica/
-.. _MIRAX: http://openslide.org/formats/mirax/
-.. _Philips: http://openslide.org/formats/philips/
-.. _Sakura: http://openslide.org/formats/sakura/
-.. _Trestle: http://openslide.org/formats/trestle/
-.. _Ventana: http://openslide.org/formats/ventana/
-.. _`Generic tiled TIFF`: http://openslide.org/formats/generic-tiff/
+.. _OpenSlide: https://openslide.org/
+.. _Aperio: https://openslide.org/formats/aperio/
+.. _Hamamatsu: https://openslide.org/formats/hamamatsu/
+.. _Leica: https://openslide.org/formats/leica/
+.. _MIRAX: https://openslide.org/formats/mirax/
+.. _Philips: https://openslide.org/formats/philips/
+.. _Sakura: https://openslide.org/formats/sakura/
+.. _Trestle: https://openslide.org/formats/trestle/
+.. _Ventana: https://openslide.org/formats/ventana/
+.. _`Generic tiled TIFF`: https://openslide.org/formats/generic-tiff/
.. _`GNU Lesser General Public License, version 2.1`: https://raw.github.com/openslide/openslide-python/master/lgpl-2.1.txt
@@ -99,7 +99,7 @@ OpenSlide objects
.. attribute:: properties
Metadata about the slide, in the form of a
- :class:`Mapping <collections.Mapping>` from OpenSlide property name to
+ :class:`~collections.abc.Mapping` from OpenSlide property name to
property value. Property values are always strings. OpenSlide
provides some :ref:`standard properties <Standard properties>`, plus
additional properties that vary by slide format.
@@ -107,7 +107,7 @@ OpenSlide objects
.. attribute:: associated_images
Images, such as label or macro images, which are associated with this
- slide. This is a :class:`Mapping <collections.Mapping>` from image
+ slide. This is a :class:`~collections.abc.Mapping` from image
name to RGBA :class:`Image <PIL.Image.Image>`.
Unlike in the C interface, these images are not premultiplied.
=====================================
doc/jekyll_fix.py
=====================================
@@ -36,7 +36,14 @@ from sphinx.util.console import bold
def remove_directory_underscores(app, exception):
if exception:
return
- app.info(bold('fixing directory names... '), True)
+ # Get logger
+ try:
+ from sphinx.util import logging
+ logger = logging.getLogger(__name__)
+ except (ImportError, AttributeError):
+ # Sphinx < 1.6
+ logger = app
+ logger.info(bold('fixing directory names... '), nonl=True)
# Rewrite references in HTML/JS files
for dirpath, _, filenames in os.walk(app.outdir):
for filename in filenames:
@@ -61,7 +68,7 @@ def remove_directory_underscores(app, exception):
newfile = os.path.join(newdir, filename)
os.rename(oldfile, newfile)
os.rmdir(olddir)
- app.info('done')
+ logger.info('done')
def setup(app):
=====================================
openslide/__init__.py
=====================================
@@ -23,9 +23,15 @@ This package provides Python bindings for the OpenSlide library.
"""
from __future__ import division, print_function
-from collections import Mapping
from PIL import Image
+try:
+ # Python 3.3+
+ from collections.abc import Mapping
+except ImportError:
+ # Python 2
+ from collections import Mapping
+
from openslide import lowlevel
# For the benefit of library users
=====================================
openslide/_version.py
=====================================
@@ -22,4 +22,4 @@
This module is an implementation detail. The package version should be
obtained from openslide.__version__."""
-__version__ = u'1.1.1'
+__version__ = u'1.1.2'
=====================================
openslide/lowlevel.py
=====================================
@@ -37,6 +37,8 @@ import PIL.Image
import platform
import sys
+from . import _convert
+
if platform.system() == 'Windows':
_lib = cdll.LoadLibrary('libopenslide-0.dll')
elif platform.system() == 'Darwin':
@@ -57,58 +59,6 @@ elif platform.system() == 'Darwin':
else:
_lib = cdll.LoadLibrary('libopenslide.so.0')
-try:
- from . import _convert
- def _load_image(buf, size):
- '''buf must be a mutable buffer.'''
- _convert.argb2rgba(buf)
- return PIL.Image.frombuffer('RGBA', size, buf, 'raw', 'RGBA', 0, 1)
-except ImportError:
- def _load_image(buf, size):
- '''buf must be a buffer.'''
-
- # Load entire buffer at once if possible
- MAX_PIXELS_PER_LOAD = (1 << 29) - 1
- # Otherwise, use chunks smaller than the maximum to reduce memory
- # requirements
- PIXELS_PER_LOAD = 1 << 26
-
- def do_load(buf, size):
- '''buf can be a string, but should be a ctypes buffer to avoid an
- extra copy in the caller.'''
- # First reorder the bytes in a pixel from native-endian aRGB to
- # big-endian RGBa to work around limitations in RGBa loader
- rawmode = (sys.byteorder == 'little') and 'BGRA' or 'ARGB'
- buf = PIL.Image.frombuffer('RGBA', size, buf, 'raw', rawmode, 0, 1)
- # Image.tobytes() is named tostring() in Pillow 1.x and PIL
- buf = (getattr(buf, 'tobytes', None) or buf.tostring)()
- # Now load the image as RGBA, undoing premultiplication
- return PIL.Image.frombuffer('RGBA', size, buf, 'raw', 'RGBa', 0, 1)
-
- # Fast path for small buffers
- w, h = size
- if w * h <= MAX_PIXELS_PER_LOAD:
- return do_load(buf, size)
-
- # Load in chunks to avoid OverflowError in PIL.Image.frombuffer()
- # https://github.com/python-pillow/Pillow/issues/1475
- if w > PIXELS_PER_LOAD:
- # We could support this, but it seems like overkill
- raise ValueError('Width %d is too large (maximum %d)' %
- (w, PIXELS_PER_LOAD))
- rows_per_load = PIXELS_PER_LOAD // w
- img = PIL.Image.new('RGBA', (w, h))
- for y in range(0, h, rows_per_load):
- rows = min(h - y, rows_per_load)
- if sys.version[0] == '2':
- chunk = buffer(buf, 4 * y * w, 4 * rows * w)
- else:
- # PIL.Image.frombuffer() won't take a memoryview or
- # bytearray, so we can't avoid copying
- chunk = memoryview(buf)[y * w:(y + rows) * w].tobytes()
- img.paste(do_load(chunk, (w, rows)), (0, y))
- return img
-
class OpenSlideError(Exception):
"""An error produced by the OpenSlide library.
@@ -167,6 +117,11 @@ class _utf8_p(object):
else:
raise TypeError('Incorrect type')
+def _load_image(buf, size):
+ '''buf must be a mutable buffer.'''
+ _convert.argb2rgba(buf)
+ return PIL.Image.frombuffer('RGBA', size, buf, 'raw', 'RGBA', 0, 1)
+
# check for errors opening an image file and wrap the resulting handle
def _check_open(result, _func, _args):
if result is None:
=====================================
openslide_python.egg-info/PKG-INFO
=====================================
@@ -1,10 +1,10 @@
-Metadata-Version: 1.1
+Metadata-Version: 1.2
Name: openslide-python
-Version: 1.1.1
+Version: 1.1.2
Summary: Python interface to OpenSlide
-Home-page: http://openslide.org/
-Author: OpenSlide project
-Author-email: openslide-users at lists.andrew.cmu.edu
+Home-page: https://openslide.org/
+Maintainer: OpenSlide project
+Maintainer-email: openslide-users at lists.andrew.cmu.edu
License: GNU Lesser General Public License, version 2.1
Description: ================
OpenSlide Python
@@ -33,16 +33,16 @@ Description: ================
* Ventana_ (``.bif``, ``.tif``)
* `Generic tiled TIFF`_ (``.tif``)
- .. _OpenSlide: http://openslide.org/
- .. _Aperio: http://openslide.org/formats/aperio/
- .. _Hamamatsu: http://openslide.org/formats/hamamatsu/
- .. _Leica: http://openslide.org/formats/leica/
- .. _MIRAX: http://openslide.org/formats/mirax/
- .. _Philips: http://openslide.org/formats/philips/
- .. _Sakura: http://openslide.org/formats/sakura/
- .. _Trestle: http://openslide.org/formats/trestle/
- .. _Ventana: http://openslide.org/formats/ventana/
- .. _`Generic tiled TIFF`: http://openslide.org/formats/generic-tiff/
+ .. _OpenSlide: https://openslide.org/
+ .. _Aperio: https://openslide.org/formats/aperio/
+ .. _Hamamatsu: https://openslide.org/formats/hamamatsu/
+ .. _Leica: https://openslide.org/formats/leica/
+ .. _MIRAX: https://openslide.org/formats/mirax/
+ .. _Philips: https://openslide.org/formats/philips/
+ .. _Sakura: https://openslide.org/formats/sakura/
+ .. _Trestle: https://openslide.org/formats/trestle/
+ .. _Ventana: https://openslide.org/formats/ventana/
+ .. _`Generic tiled TIFF`: https://openslide.org/formats/generic-tiff/
Requirements
@@ -60,7 +60,7 @@ Description: ================
2. ``pip install openslide-python``
- .. _`Install OpenSlide`: http://openslide.org/download/
+ .. _`Install OpenSlide`: https://openslide.org/download/
Using PIL
@@ -90,9 +90,9 @@ Description: ================
- GitHub_
- `Sample data`_
- .. _`API documentation`: http://openslide.org/api/python/
+ .. _`API documentation`: https://openslide.org/api/python/
.. _Changelog: https://raw.github.com/openslide/openslide-python/master/CHANGELOG.txt
- .. _Website: http://openslide.org/
+ .. _Website: https://openslide.org/
.. _GitHub: https://github.com/openslide/openslide-python
.. _`Sample data`: http://openslide.cs.cmu.edu/download/openslide-testdata/
@@ -116,9 +116,15 @@ Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
+Requires-Python: >=2.6, !=3.0.*, !=3.1.*, !=3.2.*
=====================================
setup.cfg
=====================================
@@ -1,5 +1,4 @@
[egg_info]
tag_build =
tag_date = 0
-tag_svn_revision = 0
=====================================
setup.py
=====================================
@@ -1,5 +1,5 @@
import os
-from setuptools import setup, Extension, Feature
+from setuptools import setup, Extension
# Load version string
_verfile = os.path.join(os.path.dirname(__file__), 'openslide', '_version.py')
@@ -15,15 +15,9 @@ setup(
packages=[
'openslide',
],
- features={
- 'performance': Feature(
- 'performance-enhancing extension module',
- standard=True,
- ext_modules=[
- Extension('openslide._convert', ['openslide/_convert.c']),
- ],
- ),
- },
+ ext_modules=[
+ Extension('openslide._convert', ['openslide/_convert.c']),
+ ],
test_suite='tests',
maintainer='OpenSlide project',
maintainer_email='openslide-users at lists.andrew.cmu.edu',
@@ -31,7 +25,7 @@ setup(
long_description=_long_description,
license='GNU Lesser General Public License, version 2.1',
keywords='openslide whole-slide image virtual slide library',
- url='http://openslide.org/',
+ url='https://openslide.org/',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
@@ -42,13 +36,19 @@ setup(
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python',
+ 'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
+ 'Programming Language :: Python :: 3.6',
+ 'Programming Language :: Python :: 3.7',
+ 'Programming Language :: Python :: 3.8',
'Topic :: Scientific/Engineering :: Bio-Informatics',
],
+ python_requires='>=2.6, !=3.0.*, !=3.1.*, !=3.2.*',
install_requires=[
'Pillow',
],
=====================================
tests/__init__.py
=====================================
@@ -19,13 +19,16 @@
from functools import wraps
import os
+from PIL import Image
import unittest
+# 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:
- import openslide._convert as _
- have_optimizations = True
-except ImportError:
- have_optimizations = False
+ Image.new('RGBA', (1, 0))
+ image_dimensions_cannot_be_zero = False
+except ValueError:
+ image_dimensions_cannot_be_zero = True
def file_path(name):
=====================================
tests/test_imageslide.py
=====================================
@@ -22,7 +22,7 @@ from openslide import ImageSlide, OpenSlideError
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 @@ class TestImage(unittest.TestCase):
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))
=====================================
tests/test_openslide.py
=====================================
@@ -25,7 +25,7 @@ import re
import sys
import unittest
-from . import file_path, have_optimizations, skip_if
+from . import file_path, image_dimensions_cannot_be_zero, skip_if
# Tests should be written to be compatible with Python 2.6 unittest.
@@ -110,6 +110,7 @@ class TestSlide(_SlideTest, unittest.TestCase):
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))
@@ -122,23 +123,18 @@ class TestSlide(_SlideTest, unittest.TestCase):
self.assertRaises(OpenSlideError,
lambda: self.osr.read_region((0, 0), 1, (400, -5)))
+ @skip_if(sys.maxsize < 1 << 32, '32-bit Python')
+ # Broken on PIL and on Pillow >= 3.4.0, < 6.2.0.
+ # https://github.com/python-pillow/Pillow/issues/3963
+ @skip_if([int(i) for i in getattr(Image, '__version__', '0').split('.')] < [6,2,0],
+ 'broken on PIL and Pillow < 6.2.0')
# Disabled to avoid OOM killer on small systems, since the stdlib
# doesn't provide a way to find out how much RAM we have
- @skip_if(sys.maxsize < 1 << 32, '32-bit Python')
- # Also skips Pillow < 2.1.0
- @skip_if(have_optimizations and not hasattr(Image, 'PILLOW_VERSION'),
- 'broken on PIL')
def _test_read_region_2GB(self):
self.assertEqual(
self.osr.read_region((1000, 1000), 0, (32768, 16384)).size,
(32768, 16384))
- @skip_if(have_optimizations, 'only relevant --without-performance')
- @skip_if(sys.maxsize < 1 << 32, '32-bit Python')
- def test_read_region_2GB_width(self):
- self.assertRaises(ValueError,
- lambda: self.osr.read_region((1000, 1000), 0, (1 << 29, 1)))
-
def test_thumbnail(self):
self.assertEqual(self.osr.get_thumbnail((100, 100)).size, (100, 83))
View it on GitLab: https://salsa.debian.org/med-team/openslide-python/-/commit/af4e2a2976df2eb0963eead63e0063e545de5680
--
View it on GitLab: https://salsa.debian.org/med-team/openslide-python/-/commit/af4e2a2976df2eb0963eead63e0063e545de5680
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20201006/b9821437/attachment-0001.html>
More information about the debian-med-commit
mailing list