Stop passing literal quotes as package_folder_prefix - #290
Conversation
06562d2 to
0fe2415
Compare
|
Sorry for the slop description/PR. |
The gawk wraps the list in literal double quotes. build_bundles splits the
argument on ", " and matches with str.startswith(), so the first and last
entries of the list arrive with a stray quote attached and match no folder.
Latent here today: with this change the bundle is byte-identical to main,
1788 files. Only 11 of the 47 entries belong to libraries that still reach
_detect_legacy_package_structure; the rest declare tool.setuptools.packages
in pyproject.toml and never consult the prefix. It bites when the first or
last entry in ls -U order is one of those 11, which reordering can change.
Drop the quotes. build.sh already passes "$P". In release.yml the value was
expanded unquoted, so compute it in the step that consumes it and pass it as
"$prefix" rather than routing it through $GITHUB_OUTPUT and an expression,
which splices a directory name into the script as text.
Refuse an empty list: "".startswith("") is True, so an empty prefix makes
every folder a package.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
0fe2415 to
c16a47d
Compare
|
Correcting my own description: I first wrote that two libraries are currently mis-bundled here. That is wrong, and I have edited the body. Measured after opening it — this PR's bundle is byte-identical to main's, so the defect is latent in this repo. Only 11 of the 47 prefix entries belong to libraries that still use legacy autodetection, and neither of the two damaged entries is one of them right now. Still worth taking as hardening rather than a fix, and the 🤖 Generated with Claude Code |
tannewt
left a comment
There was a problem hiding this comment.
Does the official bundle have the same issue? I suspect they use the same github actions.
Great question, probably, but I think we mostly avoid the older project style these days. |
build.shandrelease.ymlbuild the--package_folder_prefixlist with a gawk that wraps it in literal double quotes.build_bundlessplits that argument on", "and matches each entry withstr.startswith(), so the first and last entries arrive as\"fooandbar\"and match no folder.Reproduced with build-tools 1.20.1 by calling
get_package_info()directly:sensirion_i2c_sen5xis_package=True, 33 files\"sensirion_i2c_sen5xis_package=False,module_name=conftest, 1 fileLatent here today. With this change the bundle is byte-identical to main — 1788 files in the
pybundle, same list, same 6839808 bytes. Of the 47 entries in the prefix list, only 11 belong to libraries that still reach_detect_legacy_package_structure; the other 36 declaretool.setuptools.packagesinpyproject.toml, which takes precedence and never consults the prefix. So it only bites when the first or last entry inls -Uorder is one of those 11 — currently neither is. Adding, removing or reordering a library can change that.It is not latent everywhere. In a fork of this bundle carrying two third-party libraries with no
[tool.setuptools]metadata, both entries are the quoted ones, and the released bundle was 4 KB containing a singleconftestmodule.Changes:
build.shalready passes"$P".release.ymlexpanded the value unquoted, which is what the literal quotes were accidentally doing. Compute it in the step that consumes it and pass"$prefix", rather than routing a directory name through$GITHUB_OUTPUTand an expression that splices it into the script as text."".startswith("")is True, so an empty prefix makes every folder a package.CI on this PR is green and, as above, produces exactly the same bundle as main.
🤖 Generated with Claude Code