Commit 12fe7cff authored by Vincent Pelletier's avatar Vincent Pelletier

apachedex: Simplify lzma detection code.

parent e457bb6f
......@@ -80,7 +80,6 @@ def _wrapOpen(func):
return srw
return wrapper
lzma = None
gzip_open = gzip.open
if sys.version_info >= (3, 3):
import lzma
......@@ -90,16 +89,15 @@ else:
gzip_open = _wrapOpen(gzip_open)
bz2_open = _wrapOpen(bz2.BZ2File)
_read_mode = 'r'
try:
from backports import lzma
except ImportError:
lzma = None
FILE_OPENER_LIST = [
(gzip_open, IOError),
(bz2_open, IOError),
]
if lzma is None:
try:
from backports import lzma
except ImportError:
pass
if lzma is not None:
FILE_OPENER_LIST.append((lzma.open, lzma.LZMAError))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment