aboutsummaryrefslogtreecommitdiff
path: root/salis.py
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2026-06-16 23:00:21 +0200
committerPaul Oliver <contact@pauloliver.dev>2026-06-16 23:05:04 +0200
commit00a0cb3821ce2bd0fc589ae64ed9cbb791ce44bb (patch)
tree62eef257fb06ea36ea92e719dff750bede0bd281 /salis.py
parentbb52acc8b7ad073068c9a2dc656d4fecf935d710 (diff)
Adds index to all large filesHEADmaster
Diffstat (limited to 'salis.py')
-rwxr-xr-xsalis.py29
1 files changed, 20 insertions, 9 deletions
diff --git a/salis.py b/salis.py
index 4e0044e..f247426 100755
--- a/salis.py
+++ b/salis.py
@@ -1,5 +1,16 @@
#!/usr/bin/env -S PYTHONDONTWRITEBYTECODE=1 python
+# index
+# [section] argument parser
+# [section] build class
+# [section] logging
+# [section] options dict formatter
+# [section] source options
+# [section] source architecture variables
+# [section] ancestor assembler
+# [section] compiler flags
+# [section] build and launch
+
import ctypes
import json
import os
@@ -15,7 +26,7 @@ from tempfile import TemporaryDirectory
from types import SimpleNamespace
# ------------------------------------------------------------------------------
-# Argument parser
+# [section] argument parser
# ------------------------------------------------------------------------------
prog = sys.argv[0]
epilog = f"Use '-h' to show command arguments; e.g. '{prog} new -h'"
@@ -92,7 +103,7 @@ for (name, sub_parsers, _), kwargs in options.items():
args = parser.parse_args()
# ------------------------------------------------------------------------------
-# Build class
+# [section] build class
# ------------------------------------------------------------------------------
class Build:
def __init__(self, path, log, library=False, cpp=False):
@@ -148,7 +159,7 @@ class Build:
if code != 0: raise RuntimeError(f"Binary returned code: {code}")
# ------------------------------------------------------------------------------
-# Logging
+# [section] logging
# ------------------------------------------------------------------------------
log_logs = []
log_ns = SimpleNamespace()
@@ -168,7 +179,7 @@ for log_level, log_msg in log_logs:
getattr(log, log_level)(log_msg)
# ------------------------------------------------------------------------------
-# Options dict formatter
+# [section] options dict formatter
# ------------------------------------------------------------------------------
fmt_h2u = lambda field: field.replace("-", "_")
fmt_u2h = lambda field: field.replace("_", "-")
@@ -189,7 +200,7 @@ def fmt_opts(opts):
return json.dumps(opts_out, indent=2)
# ------------------------------------------------------------------------------
-# Source configuration
+# [section] source options
# ------------------------------------------------------------------------------
log.info(f"Called '{prog} {args.command}' with the following options: {fmt_opts(vars(args))}")
ns = SimpleNamespace()
@@ -283,14 +294,14 @@ if args.command == "client":
log.info(f"Confirmed server and client are running against the same git hash: {server_hash}")
# ------------------------------------------------------------------------------
-# Architecture variables
+# [section] source architecture variables
# ------------------------------------------------------------------------------
arch_path = os.path.join("arch", args.arch, "vars.py")
log.info(f"Loading architecture variables from: {arch_path}")
arch_vars = runpy.run_path(arch_path, init_globals=globals())
# ------------------------------------------------------------------------------
-# Assembler
+# [section] ancestor assembler
# ------------------------------------------------------------------------------
anc_path = os.path.join("anc", args.arch, f"{args.anc}.asm")
@@ -323,7 +334,7 @@ anc_repr = f"{{{",".join(map(str, anc_bytes))}}}"
log.info(f"Compiled ancestor file '{anc_path}' into byte array: {anc_repr}")
# ------------------------------------------------------------------------------
-# Compiler flags
+# [section] compiler flags
# ------------------------------------------------------------------------------
def pop_ui_vars():
ns.ui_path = os.path.join("ui", args.ui, "vars.py")
@@ -431,7 +442,7 @@ if args.command == "client":
ns.b.links.add("-lm")
# ------------------------------------------------------------------------------
-# Build and launch executable
+# [section] build and launch
# ------------------------------------------------------------------------------
ns.b.build()
ns.b.exec()