1#!/bin/bash 2 3set -ex 4 5# Remove any pre-existing protobuf installation. 6brew uninstall protobuf 7 8# change to repo root 9pushd $(dirname $0)/../../../.. 10 11# Create stage dir 12ORIGINAL_DIR=`pwd` 13pushd .. 14cp -R $ORIGINAL_DIR stage 15export STAGE_DIR="`pwd`/stage" 16popd 17 18export REPO_DIR=protobuf 19export BUILD_VERSION=`grep -i "version" python/google/protobuf/__init__.py | grep -o "'.*'" | tr -d "'"` 20export BUILD_COMMIT=`git rev-parse HEAD` 21export PLAT=x86_64 22export UNICODE_WIDTH=32 23export MACOSX_DEPLOYMENT_TARGET=10.9 24export TRAVIS_OS_NAME="osx" 25 26rm -rf artifacts/ 27rm -rf multibuild/ 28mkdir artifacts 29export ARTIFACT_DIR=$(pwd)/artifacts 30 31git clone https://github.com/matthew-brett/multibuild.git 32# Pin multibuild scripts at a known commit to avoid potentially unwanted future changes from 33# silently creeping in (see https://github.com/protocolbuffers/protobuf/issues/9180). 34# IMPORTANT: always pin multibuild at the same commit for: 35# - linux/build_artifacts.sh 36# - linux/build_artifacts.sh 37# - windows/build_artifacts.bat 38(cd multibuild; git checkout b89bb903e94308be79abefa4f436bf123ebb1313) 39cp kokoro/release/python/macos/config.sh config.sh 40 41OLD_PATH=$PATH 42 43build_artifact_version() { 44 MB_PYTHON_VERSION=$1 45 46 # Clean up env 47 rm -rf venv 48 sudo rm -rf $REPO_DIR 49 cp -R $STAGE_DIR $REPO_DIR 50 export PATH=$OLD_PATH 51 52 source multibuild/common_utils.sh 53 source multibuild/travis_steps.sh 54 before_install 55 56 clean_code $REPO_DIR $BUILD_COMMIT 57 58 build_wheel $REPO_DIR/python $PLAT 59 60 mv wheelhouse/* $ARTIFACT_DIR 61} 62 63export MB_PYTHON_OSX_VER=10.9 64build_artifact_version 3.7 65build_artifact_version 3.8 66build_artifact_version 3.9 67build_artifact_version 3.10 68