[WS] Use tup to build projects

git-svn-id: svn://kolibrios.org@9377 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
2021-12-03 21:20:06 +00:00
parent 84837f41d5
commit 4bf8ca235a
5 changed files with 73 additions and 155 deletions

View File

@@ -51,7 +51,7 @@ def run_qemu(start_dir = "workspace"):
return subprocess.Popen(a, bufsize = 0, stdout = qemu_stdout, stderr = qemu_stderr, stdin = subprocess.DEVNULL, start_new_session = True)
if __name__ == "__main__":
program_files = build()
program_name = build()
os.makedirs("workspace", exist_ok = True)
@@ -72,19 +72,16 @@ if __name__ == "__main__":
img.delete_path("DEMOS")
img.delete_path("3D")
log("Moving program files into kolibri image... ", end = "")
for file_name in program_files:
with open(file_name, "rb") as file:
file_data = file.read()
if not img.add_file_path(file_name.upper(), file_data):
print(f"Coudn't move {file_name} into IMG")
log("Moving program into kolibri image... ", end = "")
with open(program_name, "rb") as file:
file_data = file.read()
if not img.add_file_path(program_name.upper(), file_data):
print(f"Coudn't move {program_name} into IMG")
log("Done")
# TODO: Figure out which of compiled files is a program executable and only run it
log("Adding program to autorun.dat", end = "")
lines_to_add = b""
for file_name in program_files:
lines_to_add += bytes(f"\r\n/SYS/{file_name.upper()}\t\t""\t0\t# Your program", "ascii")
log("Adding program to autorun.dat... ", end = "")
lines_to_add = bytes(f"\r\n/SYS/{program_name.upper()}\t\t""\t0\t# Your program", "ascii")
autorun_dat = img.extract_file_path("SETTINGS\AUTORUN.DAT")
place_for_new_lines = autorun_dat.index(b"\r\n/SYS/@TASKBAR")# b"\r\n### Hello, ASM World! ###")
autorun_dat = autorun_dat[:place_for_new_lines] + lines_to_add + autorun_dat[place_for_new_lines:]