[WS] Use lib/build.py to download kolibri.img

git-svn-id: svn://kolibrios.org@9390 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
2021-12-04 12:07:06 +00:00
parent a68941be35
commit 23fe7cf9ee
3 changed files with 13 additions and 15 deletions

View File

@@ -1,15 +1,18 @@
import os
import shutil
from .network import download
from .constants import tools_cache
def builds_get(path):
def builds_get(path, output_path = None):
url = f"http://builds.kolibrios.org/{path}"
output_path = f"{tools_cache}/builds.kolibrios.org/{path}"
output_dir = os.path.dirname(output_path)
os.makedirs(output_dir, exist_ok = True)
download(url, output_path, skip_exist = True)
return output_path
cached_path = f"{tools_cache}/builds.kolibrios.org/{path}"
os.makedirs(os.path.dirname(cached_path), exist_ok = True)
download(url, cached_path, skip_exist = True)
if output_path != None:
shutil.copyfile(cached_path, output_path)
return output_path
return cached_path
def builds_get_contents(path):
output_path = builds_get(path)