From fe42499cdd2e56e61adfe77d8c69583435bd5fed Mon Sep 17 00:00:00 2001 From: Anas Khan <83116240+anxkhn@users.noreply.github.com> Date: Sat, 4 Jul 2026 20:21:49 +0530 Subject: [PATCH] [Python][Packaging] Set MACOSX_DEPLOYMENT_TARGET default before building wheel platform tag In ci/scripts/python_wheel_macos_build.sh the wheel platform tag _PYTHON_HOST_PLATFORM was assembled from MACOSX_DEPLOYMENT_TARGET one line before that variable's :-12.0 default was applied. When the script runs without MACOSX_DEPLOYMENT_TARGET already exported (for example a manual or local macOS build), the interpolation yields a malformed tag with an empty version component (macosx--), while the C++ libraries and the wheel are actually built for 12.0. That produces an inconsistent, invalid platform tag on the built wheel. Swap the two lines so the default is set first and the platform tag is derived from the resolved value. When MACOSX_DEPLOYMENT_TARGET is already set (as in the packaging CI, which exports it as a top-level env var), the output is unchanged, so there is no behavior change for existing jobs. Verified the two lines in isolation with the variable unset: before the change _PYTHON_HOST_PLATFORM=macosx--x86_64, after the change macosx-12.0-x86_64. The full macOS wheel build was not run (no Arrow C++ toolchain available locally). --- ci/scripts/python_wheel_macos_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/scripts/python_wheel_macos_build.sh b/ci/scripts/python_wheel_macos_build.sh index 551d2151b5bc..8d82e853b6c8 100755 --- a/ci/scripts/python_wheel_macos_build.sh +++ b/ci/scripts/python_wheel_macos_build.sh @@ -33,8 +33,8 @@ rm -rf ${source_dir}/python/pyarrow/*.so rm -rf ${source_dir}/python/pyarrow/*.so.* echo "=== (${PYTHON_VERSION}) Set SDK, C++ and Wheel flags ===" -export _PYTHON_HOST_PLATFORM="macosx-${MACOSX_DEPLOYMENT_TARGET}-${arch}" export MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET:-12.0} +export _PYTHON_HOST_PLATFORM="macosx-${MACOSX_DEPLOYMENT_TARGET}-${arch}" export SDKROOT=${SDKROOT:-$(xcrun --sdk macosx --show-sdk-path)} if [ $arch = "arm64" ]; then