1ffe3c632Sopenharmony_ci#!/bin/bash 2ffe3c632Sopenharmony_ci 3ffe3c632Sopenharmony_ci# Print usage and fail. 4ffe3c632Sopenharmony_cifunction usage() { 5ffe3c632Sopenharmony_ci echo "Usage: protobuf_optimized_pip.sh PROTOBUF_VERSION PYPI_USERNAME PYPI_PASSWORD" >&2 6ffe3c632Sopenharmony_ci exit 1 # Causes caller to exit because we use -e. 7ffe3c632Sopenharmony_ci} 8ffe3c632Sopenharmony_ci 9ffe3c632Sopenharmony_ci# Validate arguments. 10ffe3c632Sopenharmony_ciif [ $0 != ./build_wheel_manylinux.sh ]; then 11ffe3c632Sopenharmony_ci echo "Please run this script from the directory in which it is located." >&2 12ffe3c632Sopenharmony_ci exit 1 13ffe3c632Sopenharmony_cifi 14ffe3c632Sopenharmony_ci 15ffe3c632Sopenharmony_ciif [ $# -lt 3 ]; then 16ffe3c632Sopenharmony_ci usage 17ffe3c632Sopenharmony_ci exit 1 18ffe3c632Sopenharmony_cifi 19ffe3c632Sopenharmony_ci 20ffe3c632Sopenharmony_ciPROTOBUF_VERSION=$1 21ffe3c632Sopenharmony_ciPYPI_USERNAME=$2 22ffe3c632Sopenharmony_ciPYPI_PASSWORD=$3 23ffe3c632Sopenharmony_ci 24ffe3c632Sopenharmony_cidocker rmi protobuf-python-wheel 25ffe3c632Sopenharmony_cidocker build . -t protobuf-python-wheel 26ffe3c632Sopenharmony_cidocker run --rm protobuf-python-wheel ./protobuf_optimized_pip.sh $PROTOBUF_VERSION $PYPI_USERNAME $PYPI_PASSWORD 27ffe3c632Sopenharmony_cidocker rmi protobuf-python-wheel 28