Skip to content

bug: ebuild build ignores ninja_command() and still requires the pip ninja module #159

Description

@agayushh

What happened?

ninja_command() in ebuild/build/dispatch.py prefers a ninja binary on PATH and falls back to python -m ninja.

ebuild test already uses that helper (ebuild/cli/commands.py, _run_native_tests).

ebuild build still hardcodes:

ninja_cmd = [sys.executable, "-m", "ninja", "-f", str(build_path / "build.ninja")]

### Expected behavior

```text
`ebuild build` should call `ninja_command()` the same way `ebuild test` does: use `ninja` on PATH when present, and fall back to `python -m ninja` only when no binary is found.

README.md and demo.md should describe that behavior.

### Reproduction steps

1. Open `ebuild/cli/commands.py` at the `ebuild build` ninja invocation (around line 1032).
2. Observe it always builds argv as `[sys.executable, "-m", "ninja", "-f", ...]`.
3. Compare with `_run_native_tests` in the same file (around line 2713), which already uses `ninja_command()`.
4. Compare with `ninja_command()` in `ebuild/build/dispatch.py`, whose docstring says the unconditional `python -m ninja` path was the old bug.
5. Optional: on a machine with `ninja` on PATH but the PyPI `ninja` module not installed in the venv, run `ebuild build` in `examples/hello_world` and `ebuild test` on a project with `type: test` targets. Build fails; test does not.

### Version or commit

c37e995fea8adf096d8babb2592e29967ae89462

### Environment

Linux. This is independent of board/toolchain: it is the argv `ebuild build` passes to ninja, not a compile failure.

### Logs or diagnostics

```shell
Code path on current master (`c37e995`):

ebuild/cli/commands.py:1032
    ninja_cmd = [sys.executable, "-m", "ninja", "-f", str(build_path / "build.ninja")]

ebuild/cli/commands.py:2713
    from ebuild.build.dispatch import ninja_command
    argv = ninja_command() + ["-f", str(build_path / "build.ninja")] + ...

Submission checks

  • I searched existing issues for a duplicate.
  • This report contains no security-sensitive details.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions