Repository navigation
GH-1497: [CI] Compute pom.xml paths without Python in build.sh - #1498
Conversation
macOS does not ship a python executable, so building the source
release fails when it computes pom.xml paths. Use ${PYTHON:-python3},
as dev/release/run_rat.sh already does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
How about using cd "${source_dir}" to get relative path?
| # crawl back up to the top. | |
| poms=$(cd "${source_dir}" && find . -not \( -path ./build -prune \) -type f -name pom.xml) | |
| # ./dataset/pom.xml -> dataset | |
| for source_root in $(echo "${poms}" | awk -F/ '{print $2}' | sort -u); do |
There was a problem hiding this comment.
+1 to this approach. Dropping the python/realpath branch removes the Python dependency completely, makes Linux and macOS take the exact same code path, and avoids interpolating ${source_dir} inside a single-quoted Python string.
I verified locally on macOS that cd "${source_dir}" && find . ... | awk -F/ '{print $2}' | sort -u produces the exact same top-level entries as the current os.path.relpath command (including the root pom.xml).
There was a problem hiding this comment.
Thanks, applied in 5c6bacf. This drops both the Python and realpath branches.
jbonofre
left a comment
There was a problem hiding this comment.
Thanks @andygrove for catching and fixing this! The current change works, but I would prefer @kou cd "${source_dir}" && find . suggestion so we can drop the Python dependency and the macOS specific branch altogether.
| poms=$(find "${source_dir}" -not \( -path "${source_dir}"/build -prune \) -type f -name pom.xml) | ||
| if [[ "$OSTYPE" == "darwin"* ]]; then | ||
| poms=$(echo "$poms" | xargs -n1 python -c "import sys; import os.path; print(os.path.relpath(sys.argv[1], '${source_dir}'))") | ||
| poms=$(echo "$poms" | xargs -n1 "${PYTHON:-python3}" -c "import sys; import os.path; print(os.path.relpath(sys.argv[1], '${source_dir}'))") |
There was a problem hiding this comment.
Using "${PYTHON:-python3}" fixes the missing python binary on macOS, though I prefer @kou suggest above: running find after cd "${source_dir}" removes both the Python dependency and the OS-specific if/else branch, and avoids pasting ${source_dir} directly into Python source ('${source_dir}').
There was a problem hiding this comment.
Agreed, switched to kou's approach in 5c6bacf.
Drop the Python and realpath branches so Linux and macOS share one code path with no Python dependency. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What's Changed
macOS does not ship a
pythonexecutable, soci/scripts/build.shfailed when the release verification script built the source release on macOS.The script now runs
findfrom insidesource_dirto get relative paths. This removes the Python dependency and the macOS-specific branch, so Linux and macOS use the same code path.Closes #1497.
🤖 Generated with Claude Code