forked from KolibriOS/kolibrios
[WS] Move download_if_exist to lib
git-svn-id: svn://kolibrios.org@9382 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
f505262a89
commit
460c5f6329
@ -1,3 +1,4 @@
|
|||||||
|
import os
|
||||||
import urllib.request
|
import urllib.request
|
||||||
from .logging import log
|
from .logging import log
|
||||||
|
|
||||||
@ -6,4 +7,7 @@ def download(link, path):
|
|||||||
urllib.request.urlretrieve(link, path)
|
urllib.request.urlretrieve(link, path)
|
||||||
log("Done.")
|
log("Done.")
|
||||||
|
|
||||||
|
def download_if_not_exist(link, path):
|
||||||
|
if not os.path.exists(path):
|
||||||
|
download(link, path)
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ from workspace.build import build
|
|||||||
from lib.makeflop import Floppy
|
from lib.makeflop import Floppy
|
||||||
from lib.platform import is_win32, path
|
from lib.platform import is_win32, path
|
||||||
from lib.logging import log
|
from lib.logging import log
|
||||||
from lib.network import download
|
from lib.network import download_if_not_exist
|
||||||
|
|
||||||
# TODO: Move into _tools/lib
|
# TODO: Move into _tools/lib
|
||||||
def run_qemu(start_dir = "workspace"):
|
def run_qemu(start_dir = "workspace"):
|
||||||
@ -44,9 +44,8 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
os.makedirs("workspace", exist_ok = True)
|
os.makedirs("workspace", exist_ok = True)
|
||||||
|
|
||||||
if not os.path.exists("workspace/kolibri.unmodified.img"):
|
img_url = "http://builds.kolibrios.org/eng/data/data/kolibri.img"
|
||||||
img_url = "http://builds.kolibrios.org/eng/data/data/kolibri.img"
|
download_if_not_exist(img_url, "workspace/kolibri.unmodified.img")
|
||||||
download(img_url, "workspace/kolibri.unmodified.img")
|
|
||||||
|
|
||||||
# Create a copy of IMG
|
# Create a copy of IMG
|
||||||
shutil.copyfile("workspace/kolibri.unmodified.img", "workspace/kolibri.img")
|
shutil.copyfile("workspace/kolibri.unmodified.img", "workspace/kolibri.img")
|
||||||
|
Loading…
Reference in New Issue
Block a user