Rewrite pubspec with a comment-preserving YAML library in patch_pubspec_version.py#6656
Rewrite pubspec with a comment-preserving YAML library in patch_pubspec_version.py#6656jtullos-bt wants to merge 1 commit into
Conversation
yaml.safe_load/yaml.dump strips all YAML comments, and the build template's cookiecutter conditionals live in comments (e.g. the web-only gate around the app/app.zip assets). Every released flet-build-template.zip therefore declares app.zip assets unconditionally, and desktop flet build fails at asset bundling because serious_python 4.x no longer produces app.zip on native platforms. Switch to ruamel.yaml round-trip mode so comments, ordering, and quoting survive the dependency rewrite.
|
|
|
The fix is not relying anymore on jinja expressions in yaml comments (that was fragile): https://github.com/flet-dev/flet/pull/6654/changes#diff-ec4a6066761029ec8d50029894940e3c1fd754829c0caad08292127fdbd1a09f But I don't mind using ruamel for preserving comments during CI patching. Can you please:
Thanks! |
|
I had to close this, I'm not sure I can give you a good answer to the "Your Employer" section of the CLA. It might have been fine, but I would rather not sign a legal representation I havne't verified. |
|
That's fine, thanks! |
sorry, see my comment below :( |
Description
Fixes #6655.
The CI step that publishes
flet-build-template.ziprewrites the pubspec'sfletdependency via.github/scripts/patch_pubspec_version.py, which round-trips the file throughyaml.safe_load+yaml.dumpand discards all comments, including the cookiecutter conditional markers that gate theapp/app.zipassets to web builds. The published zip therefore declares the assets unconditionally, and desktop builds require a file the packaging step never produces.This PR rewrites the pubspec in
patch_pubspec_version.pywith a comment-preserving YAML library (ruamel.yaml round-trip mode). Tested against thev0.86.0.dev1template in both patch modes; the conditionals survive and the dependency rewrite is unchanged.Test code
Repro repo demonstrating the failure on a stock GitHub macOS runner: https://github.com/jtullos-bt/flet-build-appzip-repro (failing run: https://github.com/jtullos-bt/flet-build-appzip-repro/actions/runs/28890234132)
Type of change
Additional details
The same patch step runs on stable release tags (with an exact version pin instead of a git ref), so an eventual 0.86.0 stable template zip is expected to carry the same defect unless the script is fixed first.
Summary by Sourcery
Preserve YAML comments when patching the pubspec dependency in the build template patching script so template conditionals continue to work.
Bug Fixes:
Enhancements:
Build: