[WS] Merge download_if_not_exist and download functions
git-svn-id: svn://kolibrios.org@9384 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
9b8a7d74cc
commit
b8453028f7
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user