def compare_versions(x, y):
    def version_to_tuple(version):
        # Trim off the leading v
        version_list = version[1:].split('.', 2)
        if len(version_list) <= 3:
            [version_list.append(0) for _ in range(3 - len(version_list))]
        try:
            return tuple((int(version) for version in version_list))
        except ValueError: # not an integer, so it goes to the bottom
            return (0, 0, 0)

    x_major, x_minor, x_bugfix = version_to_tuple(x)
    y_major, y_minor, y_bugfix = version_to_tuple(y)
    return (cmp(x_major, y_major) or cmp(x_minor, y_minor)
            or cmp(x_bugfix, y_bugfix))
Indicate that the response to this request is complete.
dataset/ETHPy150Open openxc/openxc-python/fabfile.py/compare_versions--crossover with--dataset/ETHPy150Open nlloyd/SubliminalCollaborator/libs/twisted/web/iweb.py/IRequest.finish