| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 | #!/usr/bin/env bash# DO NOT use this script manually! Called by docker.set -ex# Print usage and fail.function usage() {  echo "Usage: protobuf_optimized_pip.sh PROTOBUF_VERSION" >&2  exit 1   # Causes caller to exit because we use -e.}# Build wheelfunction build_wheel() {  PYTHON_VERSION=$1  PYTHON_BIN=/opt/python/${PYTHON_VERSION}/bin/python  $PYTHON_BIN setup.py bdist_wheel --cpp_implementation --compile_static_extension  auditwheel repair dist/protobuf-${PROTOBUF_VERSION}-${PYTHON_VERSION}-linux_x86_64.whl}# Validate arguments.if [ $0 != ./protobuf_optimized_pip.sh ]; then  echo "Please run this script from the directory in which it is located." >&2  exit 1fiif [ $# -lt 1 ]; then  usage  exit 1fiPROTOBUF_VERSION=$1PYPI_USERNAME=$2PYPI_PASSWORD=$3DIR=${PWD}/'protobuf-python-build'PYTHON_VERSIONS=('cp27-cp27mu' 'cp33-cp33m' 'cp34-cp34m' 'cp35-cp35m' 'cp36-cp36m')mkdir -p ${DIR}cd ${DIR}curl -SsL -O https://github.com/protocolbuffers/protobuf/archive/v${PROTOBUF_VERSION}.tar.gztar xzf v${PROTOBUF_VERSION}.tar.gzcd $DIR/protobuf-${PROTOBUF_VERSION}# Autoconf on centos 5.11 cannot recognize AC_PROG_OBJC.sed -i '/AC_PROG_OBJC/d' configure.acsed -i 's/conformance\/Makefile//g' configure.ac# Use the /usr/bin/autoconf and related tools to pick the correct aclocal macrosexport PATH="/usr/bin:$PATH"# Build protoc./autogen.shCXXFLAGS="-fPIC -g -O2" ./configuremake -j8export PROTOC=$DIR/src/protoccd pythonfor PYTHON_VERSION in "${PYTHON_VERSIONS[@]}"do  build_wheel $PYTHON_VERSIONdone/opt/python/cp27-cp27mu/bin/twine upload wheelhouse/*
 |