diff --git a/Dockerfile b/Dockerfile index c8cedaa4..11c94cd2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,8 @@ FROM debian:bookworm ARG DEBIAN_FRONTEND=noninteractive +ENV PIP_ROOT_USER_ACTION=ignore + RUN \ apt-get update \ && apt-get install -y --no-install-recommends \ @@ -16,9 +18,10 @@ RUN \ default-jre-headless \ patch \ python3 \ - python3-ruamel.yaml \ + python3-pip \ unzip \ - xz-utils + xz-utils \ + && pip install jq ruamel.yaml # Install Simplicity Commander (unfortunately no stable URL available, this # is known to be working with Commander_linux_x86_64_1v15p0b1306.tar.bz). diff --git a/README.md b/README.md index e3aaf22a..fb96fd9a 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ tool will automatically determine which SDK and toolchain to use. > automatically found so these flags can be omitted. ```bash -pip install ruamel.yaml # Only dependency +pip install jq ruamel.yaml python tools/build_project.py \ # The following SDK and toolchain flags can be omitted on macOS diff --git a/tools/build_project.py b/tools/build_project.py index 29efad21..5e355d74 100755 --- a/tools/build_project.py +++ b/tools/build_project.py @@ -19,6 +19,7 @@ import multiprocessing from datetime import datetime, timezone +import jq from ruamel.yaml import YAML @@ -374,18 +375,8 @@ def main(): for json_config in manifest.get("json_config", []): json_path = build_template_path / json_config["file"] - result = subprocess.run( - [ - "jq", - json_config["jq"], - json_path, - ], - capture_output=True, - check=True, - ) - - with open(json_path, "wb") as f: - f.write(result.stdout) + result = jq.compile(json_config["jq"]).input_text(json_path.read_text()).first() + json_path.write_text(json.dumps(result, indent=2)) # Next, generate a chip-specific project from the modified base project print(f"Generating project for {manifest['device']}")