Commit 41a9e0f1792271445e2f9a5b069732470be52b15
1 parent
6e679bb3
Exists in
master
and in
1 other branch
Better version comparison
Showing
1 changed file
with
10 additions
and
1 deletions
Show diff stats
invesalius/utils.py
@@ -23,6 +23,8 @@ import re | @@ -23,6 +23,8 @@ import re | ||
23 | import locale | 23 | import locale |
24 | import math | 24 | import math |
25 | 25 | ||
26 | +from distutils.version import LooseVersion | ||
27 | + | ||
26 | import numpy as np | 28 | import numpy as np |
27 | 29 | ||
28 | def format_time(value): | 30 | def format_time(value): |
@@ -416,7 +418,14 @@ def UpdateCheck(): | @@ -416,7 +418,14 @@ def UpdateCheck(): | ||
416 | return | 418 | return |
417 | last = response.readline().rstrip() | 419 | last = response.readline().rstrip() |
418 | url = response.readline().rstrip() | 420 | url = response.readline().rstrip() |
419 | - if (last!=const.INVESALIUS_VERSION): | 421 | + |
422 | + try: | ||
423 | + last_ver = LooseVersion(last) | ||
424 | + actual_ver = LooseVersion(const.INVESALIUS_VERSION) | ||
425 | + except (ValueError, AttributeError): | ||
426 | + return | ||
427 | + | ||
428 | + if last_ver > actual_ver: | ||
420 | print " ...New update found!!! -> version:", last #, ", url=",url | 429 | print " ...New update found!!! -> version:", last #, ", url=",url |
421 | wx.CallAfter(wx.CallLater, 1000, _show_update_info) | 430 | wx.CallAfter(wx.CallLater, 1000, _show_update_info) |
422 | 431 |