diff --git a/lbrynet/lbrynet_daemon/LBRYDaemon.py b/lbrynet/lbrynet_daemon/LBRYDaemon.py index fceacec15..bf5cfd317 100644 --- a/lbrynet/lbrynet_daemon/LBRYDaemon.py +++ b/lbrynet/lbrynet_daemon/LBRYDaemon.py @@ -1,6 +1,7 @@ import binascii from datetime import datetime from decimal import Decimal +import distutils.version import locale import logging.handlers import mimetypes @@ -2314,4 +2315,4 @@ def get_version_from_tag(tag): def compare_versions(a, b): """Returns True if version a is more recent than version b""" - return a > b + return distutils.version.StrictVersion(a) > distutils.version.StrictVersion(b) diff --git a/tests/lbrynet/lbrynet_daemon/test_LBRYDaemon.py b/tests/lbrynet/lbrynet_daemon/test_LBRYDaemon.py index 104e06c01..a0d1c346f 100644 --- a/tests/lbrynet/lbrynet_daemon/test_LBRYDaemon.py +++ b/tests/lbrynet/lbrynet_daemon/test_LBRYDaemon.py @@ -36,3 +36,6 @@ class MiscTests(unittest.TestCase): def test_error_is_thrown_when_version_cant_be_parsed(self): with self.assertRaises(Exception): LBRYDaemon.get_version_from_tag('garbage') + + def test_compare_versions_isnot_lexographic(self): + self.assertTrue(LBRYDaemon.compare_versions('0.3.10', '0.3.6'))