Skip to content

Commit 0ddf6cd

Browse files
committed
numpy version check: make it more readable
svn path=/trunk/matplotlib/; revision=8431
1 parent a67bf03 commit 0ddf6cd

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lib/matplotlib/__init__.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,10 @@
145145
raise ImportError('matplotlib requires Python 2.4 or later')
146146

147147
import numpy
148-
nn = numpy.__version__.split('.')
149-
if not (int(nn[0]) >= 1 and int(nn[1]) >= 1):
150-
if not (int(nn[0]) >= 2):
151-
raise ImportError(
152-
'numpy 1.1 or later is required; you have %s' %
153-
numpy.__version__)
148+
nmajor, nminor = [int(n) for n in numpy.__version__.split('.')[:2]]
149+
if not (nmajor > 1 or (nmajor == 1 and nminor >= 1)):
150+
raise ImportError(
151+
'numpy 1.1 or later is required; you have %s' % numpy.__version__)
154152

155153
def is_string_like(obj):
156154
if hasattr(obj, 'shape'): return 0

0 commit comments

Comments
 (0)