153
153
year = 2007
154
154
}"""
155
155
156
- try :
157
- import dateutil
158
- except ImportError :
159
- raise ImportError ("matplotlib requires dateutil" )
156
+
157
+ _python27 = (sys .version_info .major == 2 and sys .version_info .minor >= 7 )
158
+ _python34 = (sys .version_info .major == 3 and sys .version_info .minor >= 4 )
159
+ if not (_python27 or _python34 ):
160
+ raise ImportError ("Matplotlib requires Python 2.7 or 3.4 or later" )
160
161
161
162
162
163
def compare_versions (a , b ):
@@ -173,39 +174,39 @@ def compare_versions(a, b):
173
174
else :
174
175
return False
175
176
176
- if not compare_versions (six .__version__ , '1.3' ):
177
+
178
+ try :
179
+ import dateutil
180
+ except ImportError :
181
+ raise ImportError ("Matplotlib requires dateutil" )
182
+
183
+
184
+ if not compare_versions (six .__version__ , '1.10' ):
177
185
raise ImportError (
178
- 'six 1.3 or later is required ; you have %s' % (
179
- six . __version__ ))
186
+ "Matplotlib requires six>=1.10 ; you have %s" % six . __version__ )
187
+
180
188
181
189
try :
182
190
import pyparsing
183
191
except ImportError :
184
- raise ImportError ("matplotlib requires pyparsing" )
192
+ raise ImportError ("Matplotlib requires pyparsing" )
185
193
else :
186
194
if not compare_versions (pyparsing .__version__ , '2.0.1' ):
187
195
raise ImportError (
188
- "matplotlib requires pyparsing >= 2.0.1" )
189
-
190
-
191
- if not hasattr (sys , 'argv' ): # for modpython
192
- sys .argv = [str ('modpython' )]
193
-
194
-
195
- major , minor1 , minor2 , s , tmp = sys .version_info
196
- _python27 = (major == 2 and minor1 >= 7 )
197
- _python34 = (major == 3 and minor1 >= 4 )
198
-
199
- if not (_python27 or _python34 ):
200
- raise ImportError ('matplotlib requires Python 2.7 or 3.4 or later' )
196
+ "Matplotlib requires pyparsing>=2.0.1; you have %s"
197
+ % pyparsing .__version__ )
201
198
202
199
203
200
if not compare_versions (numpy .__version__ , __version__numpy__ ):
204
201
raise ImportError (
205
- 'numpy %s or later is required ; you have %s' % (
202
+ "Matplotlib requires numpy>=%s ; you have %s" % (
206
203
__version__numpy__ , numpy .__version__ ))
207
204
208
205
206
+ if not hasattr (sys , 'argv' ): # for modpython
207
+ sys .argv = [str ('modpython' )]
208
+
209
+
209
210
def _is_writable_dir (p ):
210
211
"""
211
212
p is a string pointing to a putative writable dir -- return True p
@@ -1432,7 +1433,7 @@ def _init_tests():
1432
1433
if (ft2font .__freetype_version__ != LOCAL_FREETYPE_VERSION or
1433
1434
ft2font .__freetype_build_type__ != 'local' ):
1434
1435
warnings .warn (
1435
- "matplotlib is not built with the correct FreeType version to run "
1436
+ "Matplotlib is not built with the correct FreeType version to run "
1436
1437
"tests. Set local_freetype=True in setup.cfg and rebuild. "
1437
1438
"Expect many image comparison failures below. "
1438
1439
"Expected freetype version {0}. "
@@ -1460,7 +1461,7 @@ def test(verbosity=None, coverage=False, switch_backend_warn=True,
1460
1461
"""run the matplotlib test suite"""
1461
1462
_init_tests ()
1462
1463
if not os .path .isdir (os .path .join (os .path .dirname (__file__ ), 'tests' )):
1463
- raise ImportError ("matplotlib test data is not installed" )
1464
+ raise ImportError ("Matplotlib test data is not installed" )
1464
1465
1465
1466
old_backend = get_backend ()
1466
1467
old_recursionlimit = sys .getrecursionlimit ()
@@ -1574,8 +1575,8 @@ def foo(ax, *args, **kwargs)
1574
1575
1575
1576
def param (func ):
1576
1577
new_sig = None
1577
- python_has_signature = major >= 3 and minor1 >= 3
1578
- python_has_wrapped = major >= 3 and minor1 >= 2
1578
+ # signature is since 3.3 and wrapped since 3.2, but we support 3.4+.
1579
+ python_has_signature = python_has_wrapped = six . PY3
1579
1580
1580
1581
# if in a legacy version of python and IPython is already imported
1581
1582
# try to use their back-ported signature
0 commit comments