forked from KolibriOS/kolibrios
[WS] Cache kolibri.img in _tools/cache
git-svn-id: svn://kolibrios.org@9383 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
460c5f6329
commit
9b8a7d74cc
@ -4,7 +4,9 @@
|
||||
|
||||
import os
|
||||
|
||||
from lib.network import download_if_not_exist
|
||||
from lib.logging import log
|
||||
from lib.constants import tools_cache, tools_cache_kolibri_img
|
||||
|
||||
def generate_script_executing_script(script_to_execute):
|
||||
script_to_execute = script_to_execute.replace("\\", "\\\\")
|
||||
@ -35,3 +37,7 @@ if __name__ == "__main__":
|
||||
# Initalize tup here
|
||||
# TODO: Do anything if tup doesn't exist
|
||||
os.system("tup init")
|
||||
# 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)
|
||||
|
8
_tools/lib/constants.py
Normal file
8
_tools/lib/constants.py
Normal file
@ -0,0 +1,8 @@
|
||||
import os
|
||||
|
||||
tools_lib_constants_py = os.path.abspath(__file__)
|
||||
tools_lib = os.path.dirname(tools_lib_constants_py)
|
||||
tools = os.path.dirname(tools_lib)
|
||||
tools_cache = os.path.join(tools, "cache")
|
||||
tools_cache_kolibri_img = os.path.join(tools_cache, "kolibri.img")
|
||||
|
@ -15,6 +15,7 @@ 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
|
||||
def run_qemu(start_dir = "workspace"):
|
||||
@ -44,11 +45,8 @@ if __name__ == "__main__":
|
||||
|
||||
os.makedirs("workspace", exist_ok = True)
|
||||
|
||||
img_url = "http://builds.kolibrios.org/eng/data/data/kolibri.img"
|
||||
download_if_not_exist(img_url, "workspace/kolibri.unmodified.img")
|
||||
|
||||
# Create a copy of IMG
|
||||
shutil.copyfile("workspace/kolibri.unmodified.img", "workspace/kolibri.img")
|
||||
shutil.copyfile(tools_cache_kolibri_img, "workspace/kolibri.img")
|
||||
|
||||
# Open the IMG
|
||||
with open("workspace/kolibri.img", "rb") as img:
|
||||
|
Loading…
Reference in New Issue
Block a user