From c16a47d961477f691b17a564f0b4d9dc0b4d30b4 Mon Sep 17 00:00:00 2001 From: tyeth-ai-assisted Date: Fri, 11 Sep 2026 00:37:01 +0100 Subject: [PATCH] Stop passing literal quotes as package_folder_prefix 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 --- .github/workflows/release.yml | 18 +++++++++++------- build.sh | 7 ++++++- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e3923ae..2ffd340 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,16 +32,20 @@ jobs: run: | sudo apt-get install -y gettext gawk pip install -r requirements.txt - - name: Package Folder Prefix For circuitpython-build-tools (Community Bundle Specific) - id: pkg-folder + - name: Build assets + env: + FILENAME_PREFIX: ${{ steps.repo-name.outputs.repo-name }} run: | - echo prefix=$( + prefix=$( ls -RUx | gawk -F '\n' '{ match($1, /(drivers|helpers)\/(.+)\/(.+)\:/, arr) ; if (length(arr[0]) > 0 && match(arr[3], arr[2]) > 0) printf "%s, ", arr[3] }' | - gawk '{ trimmed = substr($0, 1, length($0) - 2) ; print "\"" trimmed "\"" }' - ) >> $GITHUB_OUTPUT - - name: Build assets - run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --library_location libraries --library_depth 2 --package_folder_prefix ${{ steps.pkg-folder.outputs.prefix }} + gawk '{ print substr($0, 1, length($0) - 2) }' + ) + if [ -z "$prefix" ]; then + echo "::error::no package folders matched under libraries/" + exit 1 + fi + circuitpython-build-bundles --filename_prefix "$FILENAME_PREFIX" --library_location libraries --library_depth 2 --package_folder_prefix "$prefix" - name: Upload Release Assets uses: shogo82148/actions-upload-release-asset@v1 with: diff --git a/build.sh b/build.sh index 94ed85f..03c1ca1 100755 --- a/build.sh +++ b/build.sh @@ -29,7 +29,12 @@ set -e P=$( ls -RUx | gawk -F '\n' '{ match($1, /(drivers|helpers)\/(.+)\/(.+)\:/, arr) ; if (length(arr[0]) > 0 && match(arr[3], arr[2]) > 0) printf "%s, ", arr[3] }' | -gawk '{ trimmed = substr($0, 1, length($0) - 2) ; print "\"" trimmed "\"" }' +gawk '{ print substr($0, 1, length($0) - 2) }' ) +if [ -z "$P" ]; then + echo "error: no package folders matched under libraries/" >&2 + exit 1 +fi + circuitpython-build-bundles --filename_prefix circuitpython-community-bundle --library_location libraries --library_depth 2 --package_folder_prefix "$P"