fix LooseVersion in py3

This commit is contained in:
Ryan Pessa 2015-02-26 17:41:40 -06:00
parent 2286ae6b47
commit 4576822bb9
1 changed files with 12 additions and 5 deletions

View File

@ -17,6 +17,18 @@ from collections import OrderedDict
from time import sleep from time import sleep
if sys.version > '3':
PY3 = True
else:
PY3 = False
if PY3: # fix error with py3's LooseVersion comparisons
def ver_equal(self, other):
return self.version == other.version
LooseVersion.__eq__ = ver_equal
MIN_CYTHON_STRING = '0.20' MIN_CYTHON_STRING = '0.20'
MIN_CYTHON_VERSION = LooseVersion(MIN_CYTHON_STRING) MIN_CYTHON_VERSION = LooseVersion(MIN_CYTHON_STRING)
MAX_CYTHON_STRING = '0.21.2' MAX_CYTHON_STRING = '0.21.2'
@ -27,11 +39,6 @@ CYTHON_UNSUPPORTED = (
LooseVersion('0.22.alpha0'), LooseVersion('0.22.alpha0'),
) )
if sys.version > '3':
PY3 = True
else:
PY3 = False
def getoutput(cmd): def getoutput(cmd):
import subprocess import subprocess