This script acts as the primary entry point for staging the project.
It parses colon-separated arguments mapping specific namespaces to their
-intended build commands.
+intended build arguments.
It enforces the structural convention where authored directories must
be named <Namespace>.<Tool>. The script delegates execution to
return dict(sorted(namespaces.items()))
def print_usage(namespaces: Dict[str, Tuple[str, str]]) -> None:
- print("Usage: build [<namespace_pattern>[:<command>]*]*\n")
- print("Commands are passed directly to the component specified by the directory suffix.\n")
+ print("Usage: build [<namespace_pattern>[:<argument>]*]*\n")
+ print("Arguments are passed directly to the component specified by the directory suffix.\n")
print("Available namespaces:")
if namespaces:
print(" build Ex*:library RT:all:information (Batch execution with pattern matching)")
print(" build \"*:clean\" (Cleans all namespaces. Quotes prevent Bash expansion)")
-def run_build(cmd: str, namespace: str, tool: str, raw_dir: str) -> None:
- # Route to the new build_component subdirectory
+def run_build(argument: str, namespace: str, tool: str, raw_dir: str) -> None:
tool_path = os.path.join("tool", "build_component", tool)
if not os.path.isfile(tool_path) or not os.access(tool_path, os.X_OK):
env["NAMESPACE"] = namespace
env["NAMESPACE_DIR"] = raw_dir
- tool_cmd = [tool_path, cmd]
+ tool_cmd = [tool_path, argument]
try:
subprocess.run(tool_cmd, env=env, check=True)
for TM_arg in args:
parts = TM_arg.split(":")
pattern = parts[0]
- commands = parts[1:]
+ arguments = parts[1:]
- if not commands:
- commands = ["all"]
+ if not arguments:
+ arguments = ["all"]
matches = fnmatch.filter(ns_keys, pattern)
matched_any = True
for TM_ns in matches:
tool, raw_dir = namespaces[TM_ns]
- for TM_cmd in commands:
- run_build(TM_cmd, TM_ns, tool, raw_dir)
+ for TM_argument in arguments:
+ run_build(TM_argument, TM_ns, tool, raw_dir)
if not matched_any:
sys.exit(1)