def compare_latest_version():
    """
    Compare the current version to the latest on GitHub

    Returns version (tuple): of form (int, string):
        -1: If the current version is behind the latest
         0: If the current version is the latest
         1: If the current version is ahead of the latest
    """

    latest_release = requests.get("https://api.github.com/repos/Infraxion/Modis/releases/latest").json()
    # For when there's only one release
    if "message" not in latest_release or latest_release["message"] == "Not Found":
        latest_release = requests.get("https://api.github.com/repos/Infraxion/Modis/releases").json()[0]

    release_version_name = ""
    release_version = []
    if "tag_name" in latest_release:
        release_version_name = latest_release["tag_name"]
        release_version = release_version_name.split('.')
    current_version = version.split('.')

    for vi in range(len(release_version)):
        if len(current_version) > vi:
            if current_version[vi] > release_version[vi]:
                return 1, release_version_name
            elif current_version[vi] < release_version[vi]:
                return -1, release_version_name
        elif release_version[vi] != "0":
            return -1, release_version_name

    return 0, release_version_name
def compare_latest_version ( ) : latest_release = requests . get ( "https://api.github.com/repos/Infraxion/Modis/releases/latest" ) . json ( ) if "message" not in latest_release or latest_release [ "message" ] == "Not Found" : latest_release = requests . get ( "https://api.github.com/repos/Infraxion/Modis/releases" ) . json ( ) [ 0 ] release_version_name = "" release_version = [ ] if "tag_name" in latest_release : release_version_name = latest_release [ "tag_name" ] release_version = release_version_name . split ( '.' ) current_version = version . split ( '.' ) for vi in range ( len ( release_version ) ) : if len ( current_version ) > vi : if current_version [ vi ] > release_version [ vi ] : return 1 , release_version_name elif current_version [ vi ] < release_version [ vi ] : return - 1 , release_version_name elif release_version [ vi ] != "0" : return - 1 , release_version_name return 0 , release_version_name
Compare the current version to the latest on GitHub

    Returns version (tuple): of form (int, string):
        -1: If the current version is behind the latest
         0: If the current version is the latest
         1: If the current version is ahead of the latest