[KERNEL][TEST] Use urllib instead of wget

git-svn-id: svn://kolibrios.org@9314 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Magomed Kostoev (mkostoevr) 2021-11-25 21:54:29 +00:00
parent 16fd3a9980
commit dcb708dd09

View File

@ -4,6 +4,7 @@
import os import os
import sys import sys
import urllib
from importlib.machinery import SourceFileLoader from importlib.machinery import SourceFileLoader
from shutil import which from shutil import which
import timeit import timeit
@ -31,6 +32,11 @@ def stage(name, command, mute = False):
execute(command, mute = mute) execute(command, mute = mute)
print("Done.") print("Done.")
def download(link, path):
log(f"Downloading {path}... ", end = "")
urllib.urlretrieve(link, path)
log("Done.")
def tool_exists(name): def tool_exists(name):
assert(type(name) == str) assert(type(name) == str)
return which(name) != None return which(name) != None
@ -79,14 +85,13 @@ if __name__ == "__main__":
# Check available tools # Check available tools
tools = (("mcopy", "mtools"), tools = (("mcopy", "mtools"),
("qemu-system-i386", "qemu-system-x86"), ("qemu-system-i386", "qemu-system-x86"),
("wget", "wget"),
("fasm", "fasm")) ("fasm", "fasm"))
check_tools(tools) check_tools(tools)
# Get IMG # Get IMG
if not os.path.exists("kolibri_test.img"): if not os.path.exists("kolibri_test.img"):
if len(sys.argv) == 1: if len(sys.argv) == 1:
execute("wget -q --show-progress http://builds.kolibrios.org/eng/data/data/kolibri.img -O kolibri_test.img") download("http://builds.kolibrios.org/eng/data/data/kolibri.img", "kolibri_test.img")
else: else:
builds_eng = sys.argv[1] builds_eng = sys.argv[1]
execute(f"cp {builds_eng}/data/data/kolibri.img kolibri_test.img") execute(f"cp {builds_eng}/data/data/kolibri.img kolibri_test.img")