mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 10:59:59 +00:00
- Split dedicated deploy logic into focused modules (apps, modes, paths, proc, runner) - Ensure all make targets run from the repository root via explicit cwd handling - Fix "make: No rule to make target" errors caused by incorrect working directory - Slim down __main__ to a thin CLI entrypoint - Rework unit tests into one file per module and expand coverage https://chatgpt.com/share/69472632-9740-800f-962c-bcb4474963d6
37 lines
834 B
Python
37 lines
834 B
Python
from __future__ import annotations
|
|
|
|
import subprocess
|
|
import sys
|
|
from typing import List, Optional
|
|
|
|
|
|
def run(
|
|
cmd: List[str],
|
|
*,
|
|
cwd: Optional[str] = None,
|
|
check: bool = True,
|
|
) -> subprocess.CompletedProcess:
|
|
"""
|
|
Run a command with stdout/stderr passthrough.
|
|
|
|
Note: Many repo commands (e.g. `make`) must run in the repo root so the Makefile is found.
|
|
"""
|
|
return subprocess.run(
|
|
cmd,
|
|
cwd=cwd,
|
|
check=check,
|
|
stdout=sys.stdout,
|
|
stderr=sys.stderr,
|
|
)
|
|
|
|
|
|
def run_make(repo_root: str, *targets: str) -> None:
|
|
"""
|
|
Run `make <targets...>` from the repo root.
|
|
|
|
This prevents errors like:
|
|
make: *** No rule to make target 'clean'. Stop.
|
|
"""
|
|
final_targets = targets or ("help",)
|
|
run(["make", *final_targets], cwd=repo_root, check=True)
|