versioning.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:landscape-client 作者: CanonicalLtd 项目源码 文件源码
def is_version_higher(version1, version2):
    """Check if a version is higher than another.

    This takes two software versions in the usual b"x.y" form
    and split them on the decimal character, converting both parts
    to ints, e.g. b"3.2" becomes (3, 2).

    It then does a comparison of the two tuples, and returns C{True} if
    C{version1} is greater than or equal to C{version2}.

    @param version1: The first version to compare as C{bytes}.
    @param version2: The second version to compare as C{bytes}.
    @return: C{True} if the first version is greater than or equal to
        the second.
    """
    version1 = version1.decode("ascii")
    version2 = version2.decode("ascii")
    return StrictVersion(version1) >= StrictVersion(version2)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号