build_artifacts.sh 1.13 KB
Newer Older
1 2 3 4 5 6 7
#!/bin/bash

set -ex

# change to repo root
pushd $(dirname $0)/../../../..

8 9 10 11 12 13 14
# Create stage dir
ORIGINAL_DIR=`pwd`
pushd ..
cp -R $ORIGINAL_DIR stage
export STAGE_DIR="`pwd`/stage"
popd

15 16
export REPO_DIR=protobuf
export BUILD_VERSION=`grep -i "version" python/google/protobuf/__init__.py | grep -o "'.*'" | tr -d "'"`
17
export BUILD_COMMIT=`git rev-parse HEAD`
18 19 20 21 22
export PLAT=x86_64
export UNICODE_WIDTH=32
export MACOSX_DEPLOYMENT_TARGET=10.9
export TRAVIS_OS_NAME="osx"

23 24
rm -rf artifacts/
rm -rf multibuild/
25 26 27 28
mkdir artifacts
export ARTIFACT_DIR=$(pwd)/artifacts

git clone https://github.com/matthew-brett/multibuild.git
29
cp kokoro/release/python/macos/config.sh config.sh
30 31 32 33 34 35 36 37

OLD_PATH=$PATH

build_artifact_version() {
  MB_PYTHON_VERSION=$1

  # Clean up env
  rm -rf venv
38 39
  sudo rm -rf $REPO_DIR
  cp -R $STAGE_DIR $REPO_DIR
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
  export PATH=$OLD_PATH

  source multibuild/common_utils.sh
  source multibuild/travis_steps.sh
  before_install

  clean_code $REPO_DIR $BUILD_COMMIT

  build_wheel $REPO_DIR/python $PLAT

  mv wheelhouse/* $ARTIFACT_DIR
}

build_artifact_version 2.7
build_artifact_version 3.5
build_artifact_version 3.6
56
build_artifact_version 3.7