Skip to content

Commit

Permalink
Log SLC output.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nerivec committed Oct 29, 2024
1 parent 5055f0d commit 1b3eed6
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions tools/build_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
yaml = YAML(typ="safe")


def log_subprocess_output(pipe, prefix: str = "subprocess"):
for line in iter(pipe.readline, b""):
LOGGER.info("[%s] %r", prefix, line)


def evaulate_f_string(f_string: str, variables: dict[str, typing.Any]) -> str:
"""
Evaluates an `f`-string with the given locals.
Expand Down Expand Up @@ -371,10 +376,10 @@ def main():
yaml.dump(manifest["gbl"], f)

# Next, generate a chip-specific project from the modified base project
print(f"Generating project for {manifest['device']}")
LOGGER.info(f"Generating project for {manifest['device']}")

# fmt: off
subprocess.run(
slc_result = subprocess.Popen(
SLC
+ [
"generate",
Expand All @@ -387,10 +392,20 @@ def main():
"--sdk", sdk,
"--output-type", args.build_system,
],
check=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT
)
# fmt: on

with slc_result.stdout:
log_subprocess_output(slc_result.stdout, "SLC generate")

slc_result_returncode = slc_result.wait()

if slc_result_returncode != 0:
LOGGER.error("[SLC generate] Error: %s", slc_result_returncode)
sys.exit(1)

# Make sure all extensions are valid
for sdk_extension in base_project.get("sdk_extension", []):
expected_dir = sdk / f"extension/{sdk_extension['id']}_extension"
Expand Down

0 comments on commit 1b3eed6

Please sign in to comment.