build_artifacts.sh 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #!/bin/bash
  2. set -ex
  3. # change to repo root
  4. pushd $(dirname $0)/../../../..
  5. # Create stage dir
  6. ORIGINAL_DIR=`pwd`
  7. pushd ..
  8. cp -R $ORIGINAL_DIR stage
  9. export STAGE_DIR="`pwd`/stage"
  10. popd
  11. export REPO_DIR=protobuf
  12. export BUILD_VERSION=`grep -i "version" python/google/protobuf/__init__.py | grep -o "'.*'" | tr -d "'"`
  13. export BUILD_COMMIT=`git rev-parse HEAD`
  14. export PLAT=x86_64
  15. export UNICODE_WIDTH=32
  16. export MACOSX_DEPLOYMENT_TARGET=10.9
  17. rm -rf artifacts/
  18. rm -rf multibuild/
  19. mkdir artifacts
  20. export ARTIFACT_DIR=$(pwd)/artifacts
  21. git clone https://github.com/matthew-brett/multibuild.git
  22. cp kokoro/release/python/linux/config.sh config.sh
  23. build_artifact_version() {
  24. MB_PYTHON_VERSION=$1
  25. cp -R $STAGE_DIR $REPO_DIR
  26. source multibuild/common_utils.sh
  27. source multibuild/travis_steps.sh
  28. before_install
  29. clean_code $REPO_DIR $BUILD_COMMIT
  30. sed -i '/Wno-sign-compare/a \ \ \ \ \ \ \ \ extra_compile_args.append("-std=c++11")' $REPO_DIR/python/setup.py
  31. cat $REPO_DIR/python/setup.py
  32. build_wheel $REPO_DIR/python $PLAT
  33. mv wheelhouse/* $ARTIFACT_DIR
  34. # Clean up env
  35. rm -rf venv
  36. sudo rm -rf $REPO_DIR
  37. }
  38. build_crosscompiled_aarch64_artifact_version() {
  39. # crosscompilation is only supported with the dockcross manylinux2014 image
  40. DOCKER_IMAGE=dockcross/manylinux2014-aarch64
  41. PLAT=aarch64
  42. # TODO(jtatermusch): currently when crosscompiling, "auditwheel repair" will be disabled
  43. # since auditwheel doesn't work for crosscomiled wheels.
  44. build_artifact_version $@
  45. }
  46. build_artifact_version 2.7
  47. build_artifact_version 3.5
  48. build_artifact_version 3.6
  49. build_artifact_version 3.7
  50. build_artifact_version 3.8
  51. build_artifact_version 3.9
  52. build_crosscompiled_aarch64_artifact_version 3.7
  53. build_crosscompiled_aarch64_artifact_version 3.8
  54. build_crosscompiled_aarch64_artifact_version 3.9
  55. # Put the aarch64 manylinux wheels under the "unofficial" subdirectory.
  56. # Only wheels directly under the artifacts/ directory will be published
  57. # to PyPI as part of the protobuf release process.
  58. # TODO(jtattermusch): include aarch64 wheels in the release
  59. # once they are sufficiently tested.
  60. mkdir -p $ARTIFACT_DIR/unofficial
  61. mv $ARTIFACT_DIR/protobuf-*-manylinux*_aarch64.whl $ARTIFACT_DIR/unofficial