mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-12-19 15:22:59 +00:00
style: apply ruff autoformat
This commit is contained in:
17
cli/make.py
17
cli/make.py
@@ -3,6 +3,7 @@
|
||||
CLI wrapper for Makefile targets within Infinito.Nexus.
|
||||
Invokes `make` commands in the project root directory.
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import subprocess
|
||||
@@ -11,31 +12,31 @@ import sys
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
prog='infinito make',
|
||||
description='Run Makefile targets for Infinito.Nexus project'
|
||||
prog="infinito make",
|
||||
description="Run Makefile targets for Infinito.Nexus project",
|
||||
)
|
||||
parser.add_argument(
|
||||
'targets',
|
||||
"targets",
|
||||
nargs=argparse.REMAINDER,
|
||||
help='Make targets and options to pass to `make`'
|
||||
help="Make targets and options to pass to `make`",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
# Default to 'build' if no target is specified
|
||||
make_args = args.targets or ['build']
|
||||
make_args = args.targets or ["build"]
|
||||
|
||||
# Determine repository root (one level up from cli/)
|
||||
script_dir = os.path.dirname(os.path.realpath(__file__))
|
||||
repo_root = os.path.abspath(os.path.join(script_dir, os.pardir))
|
||||
|
||||
# Check for Makefile
|
||||
makefile_path = os.path.join(repo_root, 'Makefile')
|
||||
makefile_path = os.path.join(repo_root, "Makefile")
|
||||
if not os.path.isfile(makefile_path):
|
||||
print(f"Error: Makefile not found in {repo_root}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
# Invoke make in repo root
|
||||
cmd = ['make'] + make_args
|
||||
cmd = ["make"] + make_args
|
||||
try:
|
||||
result = subprocess.run(cmd, cwd=repo_root)
|
||||
sys.exit(result.returncode)
|
||||
@@ -46,5 +47,5 @@ def main():
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user