Skip to content

Commit 33f6774

Browse files
committed
RF: Restrict the use of indexed_gzip to versions >= 0.6.0
1 parent 198d903 commit 33f6774

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

nibabel/openers.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,19 @@
1313
import gzip
1414
import sys
1515
from os.path import splitext
16+
from distutils.version import StrictVersion
1617

17-
# is indexed_gzip present?
18+
# is indexed_gzip present and modern?
1819
try:
19-
from indexed_gzip import SafeIndexedGzipFile
20+
from indexed_gzip import SafeIndexedGzipFile, __version__ as version
21+
22+
if StrictVersion(version) < StrictVersion("0.6.0"):
23+
raise ImportError('indexed_gzip is present, but too old '
24+
'(>= 0.6.0 required): {})'.format(version))
25+
26+
del version
2027
HAVE_INDEXED_GZIP = True
28+
2129
except ImportError:
2230
HAVE_INDEXED_GZIP = False
2331

0 commit comments

Comments
 (0)