Skip to content

master does not parse — orphan else: in dispatch.py breaks every ebuild command #87

Closed

Description

@srpatcha

ebuild/build/dispatch.py on master does not parse. The package cannot be
imported, so no ebuild command runs at all.

$ git show origin/master:ebuild/build/dispatch.py > /tmp/d.py
$ python3 -c "import ast; ast.parse(open('/tmp/d.py').read())"
  File "dispatch.py", line 133
        else:
        ^^^^
SyntaxError: invalid syntax

The line:

128         raise ValueError(
129             f"Unknown build backend '{backend}'. "
130             f"Supported backends: {', '.join(sorted(ALL_BACKENDS))}"
131         )
132
133         else:                        <-- no `if` to attach to
134             raise RuntimeError(
135                 f"BackendDispatcher cannot configure backend '{backend}'. "

An else: with nothing to bind to, immediately after a completed raise.

Cause

Two different designs for the unknown-backend error path — one raising
ValueError, one raising RuntimeError — were each green on their own branch
and squash-merged onto a base that had moved. The merge kept the first raise and
the second's else:, producing a file that no version of the code ever looked
like. Nothing recompiled the result before it became master.

Identical in shape to eos#92, where sync.c ended up referencing original_prio
from one priority-inheritance design and g_blocked_on from another. Same root
cause, different repository.

Impact

Total. dispatch.py is imported by the CLI, so ebuild build, ebuild configure, ebuild info — every command — fails at import. The suite reports
11 failures / 190 passed on master once the file is made parseable by hand;
until then it does not collect.

Why nothing caught it

$ gh api repos/embeddedos-org/ebuild/branches/master/protection
{"checks": null, "reviews": 1, "sigs": false}

required_status_checks is null. Nothing builds or imports the merge result
before it lands. This is the third repository in the organisation with the same
gap — none has a required status check — and the second where it has already
allowed a non-compiling master.

Fixes already open

PR parses after?
#66 yes — also unifies the two error paths behind one _unknown_backend() helper. Already approved.
#78 yes
#75 no — despite the title. Its dispatch.py still fails at line 133 with the identical error. Its toolchain-flag validation is real and worth keeping, but it does not repair the syntax.

#66 is the one to take: it removes the duplication that caused this rather than
just deleting the stray else:.

The durable fix

Once #66 lands, make the existing workflow a required status check on master.
A PR whose merge result does not import then cannot merge, which is precisely
what did not happen here.

Activity

  1. srpatcha commented on Aug 31, 2026

    @srpatcha
    MemberAuthor

    master parses again and the suite runs. Verified from a fresh
    git clone --depth 1:

    dispatch.py parses OK
    287 passed, 1 skipped
    

    The orphan else: is gone.

    Leaving this open for the same reason as eos#92: the syntax error was the
    symptom, and the cause is still in place.

    $ gh api repos/embeddedos-org/ebuild/branches/master/protection
    {"checks": null, "reviews": 1, "sigs": false}
    

    required_status_checks is null. Nothing imports the package before the merge
    lands, which is how a file that does not parse became master in the first
    place — every command in the CLI broken, and no gate that would notice.

    A required check that does no more than python -c "import ebuild.build.dispatch"
    would have caught this exact failure. The suite already runs in CI; making it
    required is a settings change, not work.

    Worth doing now while the build is green rather than after the next splice.

  2. Aswin-V commented on Oct 1, 2026

    @Aswin-V
    Contributor

    Verified at master cc86aff: ebuild/build/dispatch.py parses cleanly (the orphan else: at former line 133 is gone) and the package imports. The fix landed without closing this issue, so closing now as already-resolved.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions