Skip to content

Commit

Permalink
Fix Macos arm64 build.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 708471085
  • Loading branch information
aayooush authored and copybara-github committed Dec 21, 2024
1 parent 77c56dc commit d3f075d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
15 changes: 7 additions & 8 deletions grain/oss/build_whl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@

set -e -x

CP_VERSION="cp${PYTHON_MAJOR_VERSION}${PYTHON_MINOR_VERSION}"
PYTHON_BIN_PATH="/opt/python/${CP_VERSION}-${CP_VERSION}/bin/python"

function main() {
bazel clean
bazel build ... --action_env PYTHON_BIN_PATH="${PYTHON_BIN_PATH}" --action_env MACOSX_DEPLOYMENT_TARGET=11.0
bazel test --verbose_failures --test_output=errors ... --action_env PYTHON_BIN_PATH="${PYTHON_BIN_PATH}"
bazel build ... --action_env PYTHON_BIN_PATH="${PYTHON_BIN}" --action_env MACOSX_DEPLOYMENT_TARGET=11.0
bazel test --verbose_failures --test_output=errors ... --action_env PYTHON_BIN_PATH="${PYTHON_BIN}"

DEST="/tmp/grain/all_dist"
mkdir -p "${DEST}"
Expand Down Expand Up @@ -38,11 +35,13 @@ function main() {
plat_name="--plat-name macosx_11_0_$(uname -m)"
fi

"python${PYTHON_VERSION}" setup.py bdist_wheel --python-tag py3${PYTHON_MINOR_VERSION} $plat_name
$PYTHON_BIN setup.py bdist_wheel --python-tag py3${PYTHON_MINOR_VERSION} $plat_name
cp dist/*.whl "${DEST}"

echo $(date) : "=== Auditing wheel"
auditwheel repair --plat ${AUDITWHEEL_PLATFORM} -w dist dist/*.whl
if [ -n "${AUDITWHEEL_PLATFORM}" ]; then
echo $(date) : "=== Auditing wheel"
auditwheel repair --plat ${AUDITWHEEL_PLATFORM} -w dist dist/*.whl
fi

echo $(date) : "=== Listing wheel"
ls -lrt dist/*.whl
Expand Down
2 changes: 1 addition & 1 deletion grain/oss/runner_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function update_bazel_macos {
}

function install_grain_deps {
AR_DIR="./grain/oss/array_record"
AR_DIR="$SOURCE_DIR/grain/oss/array_record"
$PYTHON_BIN -m pip install -U --find-links=$AR_DIR array_record --no-cache-dir;
$PYTHON_BIN -m pip install -U \
absl-py \
Expand Down

0 comments on commit d3f075d

Please sign in to comment.