forked from LBRYCommunity/lbry-sdk
Merge pull request #292 from lbryio/allow-rc
allow for rc in version values
This commit is contained in:
commit
f11f486f5a
2 changed files with 6 additions and 5 deletions
|
@ -1,12 +1,13 @@
|
|||
import base64
|
||||
import datetime
|
||||
import distutils.version
|
||||
import logging
|
||||
import random
|
||||
import os
|
||||
import socket
|
||||
import sys
|
||||
|
||||
import pkg_resources
|
||||
|
||||
from lbrynet.core.cryptoutils import get_lbry_hash_obj
|
||||
|
||||
|
||||
|
@ -61,10 +62,7 @@ def is_valid_blobhash(blobhash):
|
|||
|
||||
def version_is_greater_than(a, b):
|
||||
"""Returns True if version a is more recent than version b"""
|
||||
try:
|
||||
return distutils.version.StrictVersion(a) > distutils.version.StrictVersion(b)
|
||||
except ValueError:
|
||||
return distutils.version.LooseVersion(a) > distutils.version.LooseVersion(b)
|
||||
return pkg_resources.parse_version(a) > pkg_resources.parse_version(b)
|
||||
|
||||
|
||||
def deobfuscate(obfustacated):
|
||||
|
|
|
@ -17,6 +17,9 @@ class CompareVersionTest(unittest.TestCase):
|
|||
def test_version_can_have_four_parts(self):
|
||||
self.assertTrue(utils.version_is_greater_than('1.3.9.1', '1.3.9'))
|
||||
|
||||
def test_release_is_greater_than_rc(self):
|
||||
self.assertTrue(utils.version_is_greater_than('1.3.9', '1.3.9rc0'))
|
||||
|
||||
|
||||
class ObfuscationTest(unittest.TestCase):
|
||||
def test_deobfuscation_reverses_obfuscation(self):
|
||||
|
|
Loading…
Reference in a new issue