From eaa8e2352c510858f44c36fe01067bb07bd495cf Mon Sep 17 00:00:00 2001 From: John Kirkham Date: Thu, 23 Feb 2017 01:10:47 -0500 Subject: [PATCH 1/3] Try backports.lzma on Python 2. --- zarr/codecs.py | 9 +++++++-- zarr/tests/test_codecs.py | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/zarr/codecs.py b/zarr/codecs.py index 94c42ab825..f3bb672742 100644 --- a/zarr/codecs.py +++ b/zarr/codecs.py @@ -241,11 +241,16 @@ def __repr__(self): codec_registry[BZ2.codec_id] = BZ2 +lzma = None try: import lzma except ImportError: # pragma: no cover - pass -else: + try: + from backports import lzma + except ImportError: + pass + +if lzma: # noinspection PyShadowingBuiltins class LZMA(Codec): diff --git a/zarr/tests/test_codecs.py b/zarr/tests/test_codecs.py index 3406af8c06..80547e7bbb 100644 --- a/zarr/tests/test_codecs.py +++ b/zarr/tests/test_codecs.py @@ -201,11 +201,16 @@ def test_decode(self): self._test_decode_lossless(arr, **config) +lzma = None try: import lzma except ImportError: # pragma: no cover - pass -else: + try: + from backports import lzma + except ImportError: + pass + +if lzma: class TestLZMA(CodecTests, unittest.TestCase): From 2a111516a5e98304c06c8cff0d5e13fc107f7781 Mon Sep 17 00:00:00 2001 From: John Kirkham Date: Thu, 23 Feb 2017 01:12:24 -0500 Subject: [PATCH 2/3] Test using backport.lzma on Python 2.7 with tox. --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index 575004f996..3d8c0b6bc0 100644 --- a/tox.ini +++ b/tox.ini @@ -10,6 +10,7 @@ envlist = py27, py34, py35, py36, docs setenv = PYTHONHASHSEED = 42 commands = + py27: pip install -U backports.lzma python setup.py build_ext --inplace py27,py34,py35: nosetests -v --with-coverage --cover-erase --cover-package=zarr zarr py36: nosetests -v --with-coverage --cover-erase --cover-package=zarr --with-doctest --doctest-options=+NORMALIZE_WHITESPACE zarr From 3412bf3f8abdbf74f34da3e9cafdda73d5b10486 Mon Sep 17 00:00:00 2001 From: John Kirkham Date: Thu, 23 Feb 2017 01:20:22 -0500 Subject: [PATCH 3/3] Ensure `liblzma-dev` is available on Travis CI. --- .travis.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.travis.yml b/.travis.yml index d6234f4e48..1bc6e0decf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,12 @@ language: python +sudo: false + +addons: + apt: + packages: + - liblzma-dev + python: - 2.7 - 3.4