summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gemato/compression.py9
-rw-r--r--tox.ini8
2 files changed, 13 insertions, 4 deletions
diff --git a/gemato/compression.py b/gemato/compression.py
index 11ede67..145c0bf 100644
--- a/gemato/compression.py
+++ b/gemato/compression.py
@@ -1,6 +1,6 @@
# gemato: compressed file support
# vim:fileencoding=utf-8
-# (c) 2017 Michał Górny
+# (c) 2017-2018 Michał Górny
# Licensed under the terms of 2-clause BSD license
import gzip
@@ -18,9 +18,12 @@ else:
except ImportError:
bz2 = None
-try:
+# Python 3.3+ has a built-in lzma module. Older versions may have
+# an incompatible external module of the same name, so explicitly
+# force using the backport there.
+if sys.hexversion >= 0x03030000:
import lzma
-except ImportError:
+else:
try:
import backports.lzma as lzma
except ImportError:
diff --git a/tox.ini b/tox.ini
index 45f7ce7..7acc9c3 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
[tox]
-envlist = begin,py27,py34,py35,py36,pypy,pypy3,nodeps,end
+envlist = begin,py27,py34,py35,py36,pypy,pypy3,incompatible-lzma,nodeps,end
# we operate on sources anyway
skipsdist = True
@@ -54,6 +54,12 @@ basepython = python2.7
deps =
coverage
+[testenv:incompatible-lzma]
+basepython = python2.7
+deps =
+ coverage
+ pyliblzma
+
[testenv]
commands = coverage run -p -m unittest discover -v