Fix macOS framework layout so the inner bundle can be signed - #39
Merged
Conversation
The signing job failed on every python-macos-dart archive with: Python.framework: unsealed contents present in the root directory of an embedded framework macOS frameworks are VERSIONED bundles: everything at the framework root must be a symlink into Versions/Current, and only `Versions` itself may be a real directory. package-macos-for-dart.sh wrote the overlaid `Modules` and the public `Headers` as real directories at the root. That was invisible while only the outer xcframework was signed -- the outer seal does not care -- and became fatal the moment the inner framework was signed in its own right. They now go into Versions/Current with symlinks at the root, which is both what codesign requires and what CPython's own macOS framework already does for Headers and Resources. Consumers resolve Headers/ and Modules/ through the symlinks exactly as before. Also fixes the verifier, which was wrong in a way the same run exposed: it probed for `_CodeSignature` or `Versions/A/_CodeSignature`, but a versioned bundle's version directory is not always "A" -- CPython's macOS framework uses Versions/3.14 -- so a correctly signed macOS framework was reported as unsigned. It now asks `codesign -dv`, which is layout-agnostic and is the actual question. Verified with the real identity against the released 20260729 macOS archive: inner and outer both sign and verify, dart_bridge v1.7.1 (Versions/A) still verifies, and stripping the inner signature still fails the run.
FeodorFitsner
added a commit
to flet-dev/dart-bridge
that referenced
this pull request
Jul 30, 2026
xcf_verify_one probed for `_CodeSignature` or `Versions/A/_CodeSignature`. A versioned bundle keeps its signature at Versions/<name>/_CodeSignature, and the version directory is not always "A": CPython's macOS framework uses the Python version, e.g. Versions/3.14. A correctly signed framework there was therefore reported as unsigned. dart_bridge's own macOS slice does use Versions/A, so this never fired here -- it surfaced in python-build, whose Python.framework does not (flet-dev/python-build#39). Ask `codesign -dv` instead. It exits non-zero with "code object is not signed at all", which is precisely the question, and it is layout-agnostic. Verified: v1.7.1 still verifies, a macOS framework using Versions/3.14 now verifies, and stripping an inner signature still fails. Keeps this helper byte-identical to python-build's copy.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the signing job failure in run 30580489055.
The failure
Every
python-macos-dart-*archive died with:All nine iOS archives signed fine first — this is macOS-only.
Cause
macOS frameworks are versioned bundles: everything at the framework root must be a symlink into
Versions/Current, and onlyVersionsitself may be a real directory.package-macos-for-dart.shwrote the overlaidModulesand the publicHeadersas real directories at the root:That was invisible while only the outer xcframework was signed — the outer seal doesn't care — and became fatal the moment #38 started signing the inner framework in its own right.
They now go into
Versions/Currentwith symlinks at the root, which is what codesign requires and what CPython's own macOS framework already does forHeadersandResources. Consumers resolveHeaders/andModules/through the symlinks exactly as before.A second bug the same run exposed
The verifier probed for
_CodeSignatureorVersions/A/_CodeSignature. But a versioned bundle's version directory isn't alwaysA— CPython's macOS framework usesVersions/3.14— so a correctly signed macOS framework was reported as unsigned. It now askscodesign -dv, which is layout-agnostic and is the actual question being asked.Worth noting these two bugs masked each other during review: the layout bug made signing fail, and the verifier bug would have made it fail again right afterwards for a different reason.
Verified with the real identity
Against the released
20260729macOS archive:Versions/Alayout) still verifies — the verifier change is layout-agnostic, not macOS-specificHeaders/Python.h,Modules/module.modulemap)The same verifier fix goes to flet-dev/dart-bridge to keep the two helper copies byte-identical.