Skip to content

GH-1497: [CI] Compute pom.xml paths without Python in build.sh - #1498

Merged
kou merged 2 commits into
apache:mainfrom
andygrove:fix/build-sh-python3
Nov 25, 2026
Merged

kou merged 2 commits into
apache:mainfrom
andygrove:fix/build-sh-python3

Conversation

@andygrove

@andygrove andygrove commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

What's Changed

macOS does not ship a python executable, so ci/scripts/build.sh failed when the release verification script built the source release on macOS.

The script now runs find from inside source_dir to 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

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>
@andygrove andygrove added the chore PRs that make misc changes. label Nov 17, 2026
@andygrove
andygrove requested a review from jbonofre as a code owner November 17, 2026 14:25
@andygrove andygrove added the chore PRs that make misc changes. label Nov 17, 2026
@github-actions github-actions Bot added this to the 20.0.0 milestone Nov 17, 2026
Comment thread ci/scripts/build.sh Outdated
Comment on lines 46 to 56

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about using cd "${source_dir}" to get relative path?

Suggested change
# 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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+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).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, applied in 5c6bacf. This drops both the Python and realpath branches.

@jbonofre jbonofre left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread ci/scripts/build.sh Outdated
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}'))")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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}').

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, switched to kou's approach in 5c6bacf.

@lidavidm lidavidm removed this from the 20.0.0 milestone Nov 21, 2026
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>
@andygrove andygrove changed the title GH-1497: [CI] Use python3 in build.sh on macOS GH-1497: [CI] Compute pom.xml paths without Python in build.sh Nov 24, 2026
@github-actions github-actions Bot added this to the 20.1.0 milestone Nov 24, 2026

@kou kou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@kou
kou merged commit fd5fb7c into apache:main Nov 25, 2026
22 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore PRs that make misc changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CI] build.sh fails on macOS because python is not available

4 participants