Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
language: python

sudo: false

addons:
apt:
packages:
- liblzma-dev

python:
- 2.7
- 3.4
Expand Down
5 changes: 3 additions & 2 deletions numcodecs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,18 @@

from numcodecs.version import version as __version__
from numcodecs.registry import get_codec, register_codec
from numcodecs.compat import PY2

from numcodecs.zlib import Zlib
register_codec(Zlib)

from numcodecs.bz2 import BZ2
register_codec(BZ2)

if not PY2:
try:
from numcodecs.lzma import LZMA
register_codec(LZMA)
except ImportError: # pragma: no cover
pass

try:
from numcodecs import blosc as _blosc
Expand Down
10 changes: 8 additions & 2 deletions numcodecs/lzma.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@
from __future__ import absolute_import, print_function, division


_lzma = None
try:
import lzma as _lzma
except ImportError: # pragma: no cover
pass
else:
try:
from backports import lzma as _lzma
except ImportError:
pass


if _lzma:

import numpy as np
from numcodecs.abc import Codec
Expand Down
12 changes: 9 additions & 3 deletions numcodecs/tests/test_lzma.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@
from __future__ import absolute_import, print_function, division


from numcodecs.compat import PY2
_lzma = None
try:
import lzma as _lzma
except ImportError: # pragma: no cover
try:
from backports import lzma as _lzma
except ImportError:
pass


if not PY2:
if _lzma:

import lzma as _lzma
import itertools
import numpy as np
from numcodecs.lzma import LZMA
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ envlist = py27, py34, py35, docs
setenv =
PYTHONHASHSEED = 42
commands =
py27: pip install -U backports.lzma
python setup.py build_ext --inplace
py27: nosetests -v numcodecs
py34,py35: nosetests -v --with-coverage --cover-erase --cover-min-percentage=100 --cover-package=numcodecs --with-doctest --doctest-options=+NORMALIZE_WHITESPACE numcodecs
Expand Down