Skip to content

Commit 654e1fd

Browse files
astropy-buildbotddale
authored andcommitted
Consistent way of handling version checks.
1 parent b90e18b commit 654e1fd

File tree

6 files changed

+9
-8
lines changed

6 files changed

+9
-8
lines changed

lib/matplotlib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130

131131
import sys, os, tempfile
132132

133-
if sys.hexversion >= 0x03000000:
133+
if sys.version_info[0] >= 3:
134134
def ascii(s): return bytes(s, 'ascii')
135135
else:
136136
ascii = str

lib/matplotlib/axes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from __future__ import division, generators
2+
from matplotlib import IS_PY3K
23
import math, sys, warnings, datetime
34
from operator import itemgetter
45
import itertools
@@ -8468,7 +8469,7 @@ def subplot_class_factory(axes_class=None):
84688469

84698470
new_class = _subplot_classes.get(axes_class)
84708471
if new_class is None:
8471-
if sys.hexversion >= 0x03000000:
8472+
if IS_PY3K:
84728473
new_class = type("%sSubplot" % (axes_class.__name__),
84738474
(SubplotBase, axes_class),
84748475
{'_axes_class': axes_class})

lib/matplotlib/cbook.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import os.path
1414
import random
1515
import urllib2
16-
if sys.hexversion > 0x03000000:
16+
if sys.version_info[0] >= 3:
1717
import types
1818
else:
1919
import new
@@ -186,7 +186,7 @@ def __call__(self, *args, **kwargs):
186186
raise ReferenceError
187187
elif self.inst is not None:
188188
# build a new instance method with a strong reference to the instance
189-
if sys.hexversion >= 0x03000000:
189+
if sys.version_info[0] >= 3:
190190
mtd = types.MethodType(self.func, self.inst())
191191
else:
192192
mtd = new.instancemethod(self.func, self.inst(), self.klass)

lib/matplotlib/docstring.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def do_copy(target):
102102
def dedent_interpd(func):
103103
"""A special case of the interpd that first performs a dedent on
104104
the incoming docstring"""
105-
if isinstance(func, types.MethodType) and sys.hexversion <= 0x03000000:
105+
if isinstance(func, types.MethodType) and sys.version_info[0] < 3:
106106
func = func.im_func
107107
return interpd(dedent(func))
108108

lib/matplotlib/font_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,10 +1337,10 @@ def findfont(prop, fontext='ttf'):
13371337
return result
13381338

13391339
else:
1340-
if sys.hexversion >= 0x03000000:
1340+
if sys.version_info[0] >= 3:
13411341
_fmcache = os.path.join(get_configdir(), 'fontList.py3k.cache')
13421342
else:
1343-
_fmcache = os.path.join(get_configdir(), 'fontList.py3k.cache')
1343+
_fmcache = os.path.join(get_configdir(), 'fontList.cache')
13441344

13451345
fontManager = None
13461346

setupext.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
('PY_ARRAY_UNIQUE_SYMBOL', 'MPL_ARRAY_API'),
136136
('PYCXX_ISO_CPP_LIB', '1')]
137137

138-
if sys.hexversion >= 0x03000000:
138+
if sys.version_info[0] >= 3:
139139
defines.append(('PYCXX_PYTHON_2TO3', '1'))
140140

141141
setup_cfg = os.environ.get('MPLSETUPCFG', 'setup.cfg')

0 commit comments

Comments
 (0)