Imported Upstream version 3.8.0
[platform/upstream/protobuf.git] / kokoro / release / python / macos / build_artifacts.sh
1 #!/bin/bash
2
3 set -ex
4
5 # change to repo root
6 pushd $(dirname $0)/../../../..
7
8 # Create stage dir
9 ORIGINAL_DIR=`pwd`
10 pushd ..
11 cp -R $ORIGINAL_DIR stage
12 export STAGE_DIR="`pwd`/stage"
13 popd
14
15 export REPO_DIR=protobuf
16 export BUILD_VERSION=`grep -i "version" python/google/protobuf/__init__.py | grep -o "'.*'" | tr -d "'"`
17 export BUILD_COMMIT=`git rev-parse HEAD`
18 export PLAT=x86_64
19 export UNICODE_WIDTH=32
20 export MACOSX_DEPLOYMENT_TARGET=10.9
21 export TRAVIS_OS_NAME="osx"
22
23 rm -rf artifacts/
24 rm -rf multibuild/
25 mkdir artifacts
26 export ARTIFACT_DIR=$(pwd)/artifacts
27
28 git clone https://github.com/matthew-brett/multibuild.git
29 cp kokoro/release/python/macos/config.sh config.sh
30
31 OLD_PATH=$PATH
32
33 build_artifact_version() {
34   MB_PYTHON_VERSION=$1
35
36   # Clean up env
37   rm -rf venv
38   sudo rm -rf $REPO_DIR
39   cp -R $STAGE_DIR $REPO_DIR
40   export PATH=$OLD_PATH
41
42   source multibuild/common_utils.sh
43   source multibuild/travis_steps.sh
44   before_install
45
46   clean_code $REPO_DIR $BUILD_COMMIT
47
48   build_wheel $REPO_DIR/python $PLAT
49
50   mv wheelhouse/* $ARTIFACT_DIR
51 }
52
53 build_artifact_version 2.7
54 build_artifact_version 3.4
55 build_artifact_version 3.5
56 build_artifact_version 3.6
57 build_artifact_version 3.7