|
107 | 107 | import distutils.version |
108 | 108 | from itertools import chain |
109 | 109 |
|
| 110 | +import io |
| 111 | +import locale |
| 112 | +import os |
| 113 | +import re |
| 114 | +import tempfile |
| 115 | +import warnings |
| 116 | +import contextlib |
| 117 | +import distutils.sysconfig |
| 118 | + |
| 119 | +# cbook must import matplotlib only within function |
| 120 | +# definitions, so it is safe to import from it here. |
| 121 | +from matplotlib.cbook import is_string_like, mplDeprecation |
| 122 | +from matplotlib.compat import subprocess |
| 123 | +from matplotlib.rcsetup import (defaultParams, |
| 124 | + validate_backend) |
| 125 | + |
| 126 | +import numpy |
| 127 | +from six.moves.urllib.request import urlopen |
| 128 | +from six.moves import reload_module as reload |
| 129 | + |
110 | 130 | __version__ = str('1.5.dev1') |
111 | 131 | __version__numpy__ = str('1.6') # minimum required numpy version |
112 | 132 |
|
@@ -164,51 +184,18 @@ def _forward_ilshift(self, other): |
164 | 184 | return self |
165 | 185 | pyparsing.Forward.__ilshift__ = _forward_ilshift |
166 | 186 |
|
167 | | -try: |
168 | | - from urllib.request import urlopen |
169 | | -except ImportError: |
170 | | - from urllib2 import urlopen |
171 | | - |
172 | | -import io |
173 | | -import locale |
174 | | -import os |
175 | | -import re |
176 | | -import tempfile |
177 | | -import warnings |
178 | | -import contextlib |
179 | | -import distutils.sysconfig |
180 | | - |
181 | | -# cbook must import matplotlib only within function |
182 | | -# definitions, so it is safe to import from it here. |
183 | | -from matplotlib.cbook import is_string_like, mplDeprecation |
184 | | -from matplotlib.compat import subprocess |
185 | | - |
186 | | -try: |
187 | | - reload |
188 | | -except NameError: |
189 | | - # Python 3 |
190 | | - from imp import reload |
191 | | - |
192 | 187 |
|
193 | 188 | if not hasattr(sys, 'argv'): # for modpython |
194 | 189 | sys.argv = [str('modpython')] |
195 | 190 |
|
196 | 191 |
|
197 | | -from matplotlib.rcsetup import (defaultParams, |
198 | | - validate_backend) |
199 | | - |
200 | 192 | major, minor1, minor2, s, tmp = sys.version_info |
201 | | -_python24 = (major == 2 and minor1 >= 4) or major >= 3 |
| 193 | +_python26 = (major == 2 and minor1 >= 6) or major >= 3 |
202 | 194 |
|
203 | | -# the havedate check was a legacy from old matplotlib which preceeded |
204 | | -# datetime support |
205 | | -_havedate = True |
| 195 | +if not _python26: |
| 196 | + raise ImportError('matplotlib requires Python 2.6 or later') |
206 | 197 |
|
207 | | -if not _python24: |
208 | | - raise ImportError('matplotlib requires Python 2.4 or later') |
209 | 198 |
|
210 | | - |
211 | | -import numpy |
212 | 199 | if not compare_versions(numpy.__version__, __version__numpy__): |
213 | 200 | raise ImportError( |
214 | 201 | 'numpy %s or later is required; you have %s' % ( |
@@ -1125,7 +1112,6 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True): |
1125 | 1112 | rcParams['text.usetex'] = checkdep_usetex(rcParams['text.usetex']) |
1126 | 1113 |
|
1127 | 1114 | if rcParams['axes.formatter.use_locale']: |
1128 | | - import locale |
1129 | 1115 | locale.setlocale(locale.LC_ALL, '') |
1130 | 1116 |
|
1131 | 1117 |
|
|
0 commit comments