Fixed FilterPy versioning check error.

The code only worked for the third version number. If the first
or second version numbers were too small it didn't detect it.
This commit is contained in:
Roger Labbe 2015-12-20 10:08:31 -08:00
parent 033dbea735
commit 5ffd42a25d

View File

@ -38,21 +38,17 @@ np.set_printoptions(precision=3)
sys.path.insert(0, './code') # allow us to import book_format
def test_filterpy_version():
import filterpy
min_version = [0,0,28]
v = filterpy.__version__
tokens = v.split('.')
for i,v in enumerate(tokens):
if int(v) > min_version[i]:
return
i = len(tokens) - 1
if min_version[i] > int(tokens[i]):
raise Exception("Minimum FilterPy version supported is {}.{}.{}.\n"
import filterpy
from distutils.version import LooseVersion
v = filterpy.__version__
min_version = "0.1.0"
if LooseVersion(v) < LooseVersion(min_version):
raise Exception("Minimum FilterPy version supported is {}.\n"
"Please install a more recent version.\n"
" ex: pip install filterpy --upgrade".format(
*min_version))
v = int(tokens[0]*1000)
min_version))
# ensure that we have the correct filterpy loaded. This is