diff --git a/_tools/get_started.py b/_tools/get_started.py index 89c6b39c09..15abfadef7 100755 --- a/_tools/get_started.py +++ b/_tools/get_started.py @@ -4,7 +4,7 @@ import os -from lib.network import download_if_not_exist +from lib.network import download from lib.logging import log from lib.constants import tools_cache, tools_cache_kolibri_img @@ -40,4 +40,4 @@ if __name__ == "__main__": # Download IMG to _tools/cache os.makedirs(tools_cache, exist_ok = True) img_url = "http://builds.kolibrios.org/eng/data/data/kolibri.img" - download_if_not_exist(img_url, tools_cache_kolibri_img) + download(img_url, tools_cache_kolibri_img, skip_exist = True) diff --git a/_tools/lib/network.py b/_tools/lib/network.py index 97fa44e3a5..9ac9c3a16c 100644 --- a/_tools/lib/network.py +++ b/_tools/lib/network.py @@ -2,12 +2,10 @@ import os import urllib.request from .logging import log -def download(link, path): +def download(link, path, skip_exist = False): + if skip_exist and os.path.exists(path): + return log(f"Downloading {path}... ", end = "") urllib.request.urlretrieve(link, path) log("Done.") -def download_if_not_exist(link, path): - if not os.path.exists(path): - download(link, path) - diff --git a/_tools/workspace/run.py b/_tools/workspace/run.py index f50c4d9bf2..c9010af7cd 100644 --- a/_tools/workspace/run.py +++ b/_tools/workspace/run.py @@ -14,7 +14,6 @@ from workspace.build import build from lib.makeflop import Floppy from lib.platform import is_win32, path from lib.logging import log -from lib.network import download_if_not_exist from lib.constants import tools_cache_kolibri_img # TODO: Move into _tools/lib