Repository navigation
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>
| # crawl back up to the top. GNU realpath has --relative-to but this does not | ||
| # work on macOS | ||
|
|
||
| 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}'))") | ||
| else | ||
| poms=$(echo "$poms" | xargs -n1 realpath -s --relative-to="${source_dir}") | ||
| fi | ||
|
|
||
| for source_root in $(echo "${poms}" | awk -F/ '{print $1}' | sort -u); do |
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).
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}').
What's Changed
macOS does not ship a
pythonexecutable, onlypython3. When the release verification script builds the source release on macOS,ci/scripts/build.shusespythonto compute relative paths for thepom.xmlfiles, so the build fails.This uses
${PYTHON:-python3}, asdev/release/run_rat.shalready does. Linux usesrealpathand is not affected.Closes #1497.
🤖 Generated with Claude Code