diff --git a/auto-analysis/check_version.py b/auto-analysis/check_version.py index d3d31da..1b4e195 100644 --- a/auto-analysis/check_version.py +++ b/auto-analysis/check_version.py @@ -1,13 +1,21 @@ -from utils import get_version, download_file, extract_file, log +from utils import get_version, download_file, extract_file, log, DOWNLOAD_LINK import os +BASE_DIR = os.path.dirname(__file__) + + +def win_x64_version(): + url = DOWNLOAD_LINK["win"]["x64"] + dir = os.path.join(BASE_DIR, "win/x64") + + download_path = os.path.join(dir, os.path.basename(url)) + download_file(url, download_path) + extract_file(download_path, dir) + version = get_version(dir) + + open(os.path.join(dir, "LATEST_VERSION"), "w").write(version) + + if __name__ == '__main__': - DOWNLOAD_URL = "https://typora.io/windows/typora-setup-x64.exe" - BASE_DIR = os.path.join(os.path.dirname(__file__), "win/x64") + win_x64_version() - download_path = os.path.join(BASE_DIR, os.path.basename(DOWNLOAD_URL)) - download_file(DOWNLOAD_URL, download_path) - extract_file(download_path, BASE_DIR) - version = get_version(BASE_DIR) - - open("LATEST_VERSION", "w").write(version)